OVERVIEW OF PHPOVERVIEW OF PHP
BY: Tabeer PatoliBY: Tabeer Patoli
Overview Of PHP:Overview Of PHP:
PHP stands for Hypertext preprocessor.PHP stands for Hypertext preprocessor. Old name: Old name:
personal home pagepersonal home page
OROR
Professional home pageProfessional home page PHP is a server side scripting languagePHP is a server side scripting language PHP is used for web development.PHP is used for web development. It is used to create dynamic websites..It is used to create dynamic websites.. It is free & open source.It is free & open source.
History:History:
Originally created by Originally created by Rasmus LerdorfRasmus Lerdorf PHP originally PHP originally
stood for Personal stood for Personal Home PageHome Page
Used as a tool for Used as a tool for observing traffic observing traffic on webpageon webpage
Known as father Known as father of PHP.of PHP.
Upgrade in 1997 by Andi & zeev to add Upgrade in 1997 by Andi & zeev to add OOP (Object Oriented Programming)..OOP (Object Oriented Programming)..
Andi Gutmans Zeev suraski
For use the php For use the php we must have we must have install Xamp, install Xamp, Wamp or lamp.Wamp or lamp.
Now adays the Now adays the most universally most universally used xamp.used xamp.
Install xamp in C Install xamp in C drive.drive.
When installing is finished When installing is finished then start the control panel:then start the control panel:
Php opening & closing tags:Php opening & closing tags:
There are four types of PHP tags:There are four types of PHP tags:
1.1. <?php….?><?php….?>
2.2. <?.....?><?.....?>
3.3. <%....%><%....%>
4.4. <script language=“PHP”>…</script><script language=“PHP”>…</script>
The most universally effective tag style is The most universally effective tag style is first one………..first one………..
Commenting in php:Commenting in php: A commenting is the portion of a A commenting is the portion of a
program that exists only for the human program that exists only for the human reader. reader.
There are two commenting formats in php:There are two commenting formats in php: Single line commentSingle line comment
//………………////………………// Multi lines commentMulti lines comment
/*…………./*………….
…………………………………….*/.*/
Keep In mind:Keep In mind:
Every language have print function, Php use “echo” keyword to print the statement.
A statement in php is any expression that is followed by a semicolon ”;”.
merge two statements with dot “.”.
Simple programSimple program::
<?php // opening tag<?php // opening tag
echo “introduction to Php”; // print echo “introduction to Php”; // print the statementthe statement
?> // closing tag?> // closing tag
Php variable types:Php variable types:
All variables in PHP are denoted with a leading dollar sign($).All variables in PHP are denoted with a leading dollar sign($).Php has a total of seven data types:Php has a total of seven data types:1.1. Integers are whole numbers like (45, 67) Integers are whole numbers like (45, 67) 2.2. Doubles are floating point numbers like (58.4, 67.2)Doubles are floating point numbers like (58.4, 67.2)3.3. Booleans have only two possible values either true or false.Booleans have only two possible values either true or false.4.4. Null is a special type that only has one value: null.Null is a special type that only has one value: null.5.5. Strings are sequences of characters .Strings are sequences of characters .6.6. Arrays are named & indexed collections of different data Arrays are named & indexed collections of different data
types.types.7.7. Resources are special variables that hold references to resource Resources are special variables that hold references to resource
external to php (such as database connections)external to php (such as database connections)
Note: Note: variable name can consist of numbers, letters, underscores, variable name can consist of numbers, letters, underscores, but you cant use characters like (+,-,%,) etc.but you cant use characters like (+,-,%,) etc.
There Is no size limit for variables.There Is no size limit for variables.
Php constantsPhp constants A constant is a name or identifier for a simple value. A constant A constant is a name or identifier for a simple value. A constant
value can not change during the execution of the script.value can not change during the execution of the script. To define the constant you have to use define() function.To define the constant you have to use define() function. Constant identifiers are always in upper case.Constant identifiers are always in upper case. You have not need to have a constant with a $.You have not need to have a constant with a $. Constant define in single comma.Constant define in single comma.Example:Example:<?php<?phpdefine(‘MINSIZE’, 50);define(‘MINSIZE’, 50);echo MINSIZE;echo MINSIZE;?>?>
Php Operators:Php Operators:
Php supports following type of operators:Php supports following type of operators: Arithmetic operatorsArithmetic operators Comparison operatorsComparison operators Logical operatorsLogical operators Assignment operatorsAssignment operators Conditional (or ternary) operatorsConditional (or ternary) operators
Thank youThank you