PHP Overview
PHP Overview
OVERVIEW
CONTENT
Introduction
History
Basics
of PHP
and development
of PHP programming
WHAT IS PHP ?
HOW IT WORKS
2)
3)
4)
ADVANTAGES OF PHP
Freely available
The PHP group provides complete source code
free of charge
Similar syntax to C, Pearl
Works with many operating systems
Can be deployed on many web servers
Interacts with lots of databases
It is supported by many providers of webhosting
PHP 2 (PHP/FI)
First
PHP 3
The
PHP4
Added
Zend engine
Introduced 'superglobals' ($_GET)
It includes :
support
portion of Facebook
Wikipedia (MediaWiki)
Yahoo!
MyYearbook
PHP
Download database (MySQL)
Download server (Apache)
BASICS OF SYNTAX
Comments
//
,# comment
/* comment */
Echo
text
print text
VARIABLES IN PHP
<?php
$txt = "Hello World!";
$number = 16;
?>
VARIABLE TYPES
Numerical
Integer
Logical
Boolean
Alphabetical
String
set of characters
Settype($var, integer)
allows
Gettype()
(.)
strlen()
PHP OPERATORS
cases
== is equal
!= is different
Assignment operators
x+=y
x=x+y
LOGICAL OPERATORS
&& = and
|| = or
At
! = not
xor
Exactly
CONDITIONAL STATEMENTS
If/ else
After
Switch / break
Used
x : echo good;
break;
default : echo wrong input ;
}
ARRAYS IN PHP
Numeric array
Associative Arrays
MULTIDIMENSIONAL ARRAYS
$families = array
(
"Griffin"=>array
( "Peter", "Lois", "Megan" ),
"Soltis" =>array
(Johny", "Morgan" )
)
PHP LOOPING
while
do...while
PHP LOOPING
for
Repeats
choose
final condition
running
<?php
echo
"<TR> <TD>".$i."</TD><TD>".
$i*$i."</TD></TR>\n";
?>
PHP FUNCTIONS
All function starts with function($parameter)
Requirements for naming functions are same as
these for variables
The { mark opens the function code,
while }mark closes it
It can have either defined or no parameter
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>
http://www.w3schools.com/welcome.php?
name=jo&age=39
<html>
<body>
Welcome <?php echo $_GET["name"]; ?> <br />
You are <?php echo $_GET["age"]; ?> years old
</body>
</html>
http://www.w3schools.com/welcome.php
<html>
<body>
Welcome <?php echo $_POST["name"]; ?><br />
You are <?php echo $_POST["age"]; ?> years old.
</body>
</html>
TH
AN
K
YO
YO
UR
UF
OR
AT
TE
NT
ION
!
SOURCES
http://www.w3schools.com/PHP/
http://en.wikipedia.org/wiki/PHP
http://cz.php.net/
http://www.linuxsoft.cz/