Professional Documents
Culture Documents
<?php
…
?>
Comments in PHP
Standard C, C++, and shell comment symbols
# Shell-style comments
/* C-style comments
These can span multiple lines */
Variables in PHP
PHP variables must begin with a “$” sign
Global and locally-scoped variables
◦ Global variables can be used anywhere
◦ Local variables restricted to a function
or class
Certain variable names reserved by PHP
◦ Form variables ($_POST, $_GET)
◦ Server variables ($_SERVER)
◦ Etc.
Variable usage & echo
<?php
$Fee = 25; // Numerical variable
$Text = “Hello”; // String variable
if ($res == 0) {
echo ‘The variable res is equal to 0’;
}
else if (($res > 0) && ($res <= 5)) {
echo ‘The variable res is between 1 and 5’;
}
else {
echo ‘The variable res is equal to’.$res;
}
If ... Else...
If (condition)
{ <?php
If($user==“John”)
Statements;
{
echo “Hello John.”;
}
}
Else Else
{
{ echo “You are not John.”;
}
Statement;
?>
}
While Loops
While (condition)
<?php
$count=0;
{ While($count<3)
{
Statements; Print “hello PHP. ”;
$count += 1;
} // $count = $count + 1;
// or
// $count++;
?>
Login page
Registration Page
Validation Page
Admin Page
Home Page
Static Website
Static Website
Advantages
Easy to development
Cheap to development
Cheap to host
Disadvantages
Require web development expertise to
update site.
Changes and updates are very consuming
Site not as useful for the user
Dynamic Website
A site whose construction is controlled by
an application server processed by server-
side scripts.
◦ Pages of the website are not coded saved
separately.
◦ The design/template (look and feel) is saved
separately.