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.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.