Learning PHP Volume I
Ok, so here’s my first attempt at teaching PHP to someone.
Some basics first:
Every block of php code within an html page, must begin with
<?
and end with
?>
With that said lets jump into our first php code block!
Helloworld.php
<?
echo “Hello World”;
?>
Ok, so that’s the most basic script in php. Lets break it down,
<? – tells the server that a php script is about to come up and to read it as such
echo “Hello World”; – echo is how text is displayed on the screen. Whatever you put between ” ” gets displayed on the browser. So in this instance, Hello World gets displayed in your browser.
?> – Tells the server that the php script has ended.
NOTE** Every “command” in PHP MUST end with a semicolon (;). That tells the server that, that particular “command” has ended.