PHP Introduction.

Slides:



Advertisements
Similar presentations
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Advertisements

1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Php. What is PHP? PHP is an acronym for "PHP Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on.
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
PHP By Dr. Syed Noman Hasany. PHP PHP was originally created by Rasmus Lerdorf in PHP stands for PHP: Hypertext Preprocessor (a recursive acronym).
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
Mandakini Ayushi Infotech Mandakini Kumari 22 nd July PHP Basic.
Languages in WEB Presented by: Jenisha Kshatriya BCM SS09.
PHP. Why should we learn web programming? No need write socket programming. - You can forget TCP/IP & OSI layers. - Web server handles socket tasks for.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
INTERNET APPLICATION DEVELOPMENT For More visit:
Nael Alian Introduction to PHP
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
Basics and uses of php Prepared By
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
PHP. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Introduction to PHP Advanced Database System Lab no.1.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
Introduction to Web Programming. Introduction to PHP What is PHP? What is a PHP File? What is MySQL? Why PHP? Where to Start?
Introduction to PHP.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
IT ELECTIVE 2.  Web server Can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
PHP Introduction PHP is a server-side scripting language.
PHP Variables.  Variables are "containers" for storing information. How to Declare PHP Variables  In PHP, a variable starts with the $ sign, followed.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
FP512 WEB PROGRAMMING 1 PREPARED BY: PN. NUR SYUHADA BINTI MOHAMAD.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
 Before you continue you should have a basic understanding of the following:  HTML  CSS  JavaScript.
PHP Syntax You cannot view the PHP source code by selecting "View source" in the browser - you will only see the output from the PHP file, which is plain.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
PHP-Basic By- Tanvi Raval. Pre-requisites Before you continue you should have a basic understanding of the following: 1. HTML 2. JavaScript.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
CGS 3066: Web Programming and Design Spring 2016 PHP.
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
1 Server Side scripting PHP. 2 What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
PHP using MySQL Database for Web Development (part II)
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
CHAPTER 5 SERVER SIDE SCRIPTING
PHP 5 Syntax.
Introduction to Web programming
PHP (PHP: Hypertext Preprocessor)
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
Variables, Expressions, and IO
PHP Rasmus Lerdorf.
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
PHP Variables A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume) Rules for PHP variables: A variable.
PHP.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
IntroductionToPHP Static vs. Dynamic websites
Intro to PHP.
Tutorial 6 PHP & MySQL Li Xu
Tutorial 10: Programming with javascript
Introduction to PHP.
PHP an introduction.
23 PHP.
PHP By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and.
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Web Application Development Using PHP
Contact PSK Technologies Pvt. Ltd IT Company Address - Plot No-780, Near Durga Temple, Katol Road Chaoni, Nagpur-13.
Presentation transcript:

PHP Introduction

What is php? PHP stands for PHP: Hypertext Preprocessor PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use

What is a PHP File? PHP files can contain text, HTML, JavaScript code, and PHP code PHP code are executed on the server, and the result is returned to the browser as plain HTML PHP files have a default file extension of ".php"

What Can PHP Do? PHP can generate dynamic page content PHP can create, open, read, write, and close files on the server PHP can collect form data PHP can send and receive cookies PHP can add, delete, modify data in your database PHP can restrict users to access some pages on your website PHP can encrypt data With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML.

Why PHP? PHP runs on different platforms (Windows, Linux, Unix, Mac OS X, etc.) PHP is compatible with almost all servers used today (Apache, IIS, etc.) PHP has support for a wide range of databases PHP is free. Download it from the official PHP resource: www.php.net PHP is easy to learn and runs efficiently on the server side

PHP Installation What Do I Need? Set Up PHP on Your Own PC To start using PHP, you can: Find a web host with PHP and MySQL support Install a web server on your own PC, and then install PHP and MySQL Set Up PHP on Your Own PC However, if your server does not support PHP, you must: install a web server install PHP install a database, such as MySQL The official PHP website (PHP.net) has installation instructions for PHP: http://php.net/manual/en/install.php

Basic PHP Syntax A PHP script can be placed anywhere in the document. A PHP script starts with <?php and ends with ?>: <?php // PHP code goes here ?> The default file extension for PHP files is ".php". A PHP file normally contains HTML tags, and some PHP scripting code.

Basic PHP Syntax  Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another. With PHP, there are two basic statements to output text in the browser: echo and print.

Comments in PHP <?php //This is a PHP comment line /* This is a PHP comment block */ ?>

PHP Variables As with algebra, PHP variables can be used to hold values (x=5) or expressions (z=x+y). Variable can have short names (like x and y) or more descriptive names (age, carname, totalvolume). Rules for PHP variables: A variable starts with the $ sign, followed by the name of the variable A variable name must begin with a letter or the underscore character A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ) A variable name should not contain spaces Variable names are case sensitive ($y and $Y are two different variables)

Creating (Declaring) PHP Variables PHP has no command for declaring a variable. A variable is created the moment you first assign a value to it: $txt="Hello world!"; $x=5; After the execution of the statements above, the variable txt will hold the value Hello world!, and the variable xwill hold the value 5. Note: When you assign a text value to a variable, put quotes around the value.

PHP is a Loosely Typed Language In the example above, notice that we did not have to tell PHP which data type the variable is. PHP automatically converts the variable to the correct data type, depending on its value. In a strongly typed programming language, we will have to declare (define) the type and name of the variable before using it.

PHP Variable Scopes The scope of a variable is the part of the script where the variable can be referenced/used. PHP has four different variable scopes: local global static parameter

String Variables in PHP String variables are used for values that contain characters. After we have created a string variable we can manipulate it. A string can be used directly in a function or it can be stored in a variable. There is only one string operator in PHP. The concatenation operator (.)  is used to join two string values together.

PHP Operators Operator Name Description Example Result x + y Addition Sum of x and y 2 + 2 4 x - y Subtraction Difference of x and y 5 - 2 3 x * y Multiplication Product of x and y 5 * 2 10 x / y Division Quotient of x and y 15 / 5 x % y Modulus Remainder of x divided by y 5 % 2 10 % 8 10 % 2 1 2 0 - x Negation Opposite of x - 2   a . b Concatenation Concatenate two strings "Hi" . "Ha" HiHa

PHP Operators Assignment Same as... Description x = y The left operand gets set to the value of the expression on the right x += y x = x + y Addition x -= y x = x - y Subtraction x *= y x = x * y Multiplication x /= y x = x / y Division x %= y x = x % y Modulus a .= b a = a . b Concatenate two strings

PHP Operators Operator Name Description ++ x Pre-increment Increments x by one, then returns x x ++ Post-increment Returns x, then increments x by one -- x Pre-decrement Decrements x by one, then returns x x -- Post-decrement Returns x, then decrements x by one

PHP Operators Operator Name Description Example x and y And True if both x and y are true x=6 y=3  (x < 10 and y > 1) returns true x or y Or True if either or both x and y are true x=6 y=3  (x==6 or y==5) returns true x xor y Xor True if either x or y is true, but not both x=6 y=3  (x==6 xor y==3) returns false x && y x=6 y=3 (x < 10 && y > 1) returns true x || y x=6 y=3 (x==5 || y==5) returns false ! x Not True if x is not true x=6 y=3 !(x==y) returns true