Del.Icio.Us Digg Technorati Reddit Stumble Facebook

Hello World

Posted on 14 Feb 2008 14:07:08 by John Slater in PHP

As a PHP beginner the easiest thing you could ever learn is outputting 'Hello World!' using 'echo'. Before i go into echo'ing stuff i want to explain what it does.

Think of a calculator, you input stuff, the calculator does some kick ass calculation and then your answer is displayed on the screen. Well echo is the display, after something has been inputted and the process as been done, echo shows the result.

In this example we don't do much inputting or processing but as your PHP skills develop you will learn to do more. So lets get started....

Lets start PHP, to open PHP use the following code, its good practice to always close tags before you put anything between them, this is how i do it and it will minimise the chance of an error.

<?

?>

Now that we have PHP open lets echo some stuff. I'm not going to use 'Hello World!' because its for dumb people. I'm going to use 'Ello Govna!' for the smarter southern people.

<?
echo "Ello Govna!";
?>

It's as easy as that, you have your 'Hello World' echo'ing out. Now save this file as echo.php and upload it to your PHP enabled server and navigate your way to the file.


Share This Story:
digg del.icio.us Technorati reddit furl stubleupon Facebook