PHP Part 1 - V3
PHP Part 1 - V3
Semester 3
IT 3505
<?php
echo “Hellow World!";
?>
</body>
</html>
Internet
6 5 3
1
7 <HTML>
<?php PHP code
PHP
?>
interpreter
</HTML>
4
<HTML>
<B>Hello</B>
Client </HTML>
<?php
echo “My first php script”;
?>
<?php
echo "Hello World!";
?>
</body>
</html>
Example :
-1.23
1.2e3
34.45E-12
Example :
<?php
echo "This is a string literal","\n";
echo 'Another string literal';
?>
Example :
<?php
echo "This is a string literal \n";
echo 'Another string literal';
?>
Example :
<?php
echo 'How the character sequence \n works';
echo "\n As a line feed";
?>
Global
A variable declared outside a function
Static
When a function is executed, all of its variables are deleted.
If you want a local variable NOT to be deleted, use
the static keyword
$color=“Red”;
if (condition) {
//php code goes here if ($color ==“Red”) {
echo “Please Stop“ ;
} elseif (condition) { } elseif ($color ==“Yellow”) {
//php code goes here echo “Get ready“ ;
} else { } else {
//php code goes here echo “You can GO“ ;
}
} ?>
Number: 1
Number : 2
Number : 3
Number : 4
Number : 5
Number: 1
Number : 2
Number : 3
Number : 4
Number : 5
<?php
echo strlen("Hello 12
world!");
?>
function WriteThis() {
echo “I’m an undergraduate”;
}
setMarks(95);
setMarks(); // will use the default value of 50
setMarks(78);
setMarks(80);
?>