NameSilo

TUTORIAL: Starting with PHP

Spaceship Spaceship
Watch

PoorDoggie

Soon to be RICHdoggie!VIP Member
Impact
18
Hello... here is the beginer's tutorial to starting php:

Ok, here is your first script - The, infamous, astounding, excellent Hello World application:

PHP:
<?php

echo "Hello, World";

?>

Take a look at that code. Now you need the <?php & ?> tags. They tell your server (as it is a server-side program, which means that the server processes it before sending the output to the users browser) that the page you are trying to access has php that needs to be compiled.

Chances are that you will need to save your script as a php file. Save it as something memorable, so that you can view it first (ie: hello.php). If you are using notepad to write this then you should insert the name (in the save box) with double quotes round it: "hello.php". This will save it as a php file.

Run the program now. The browser should show "Hello, World" in the top left hand corner.

The "echo" command just prints a string of text to the browser. So thats why you see "Hello, World" from "echo "Hello, World";".

Well done, that is your first php script! :) Hope this helps anyone who wants to start PHP! :)

Websites to visit: www.webmonkey.com, www.php.net
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Nice introduction to the Hello World program, and I agree php.net all the way :tu:
 
0
•••
thanks - thought I would post it after reading SecondVersion's "hehe" thread!
 
0
•••
PoorDoggie said:
thanks - thought I would post it after reading SecondVersion's "hehe" thread!
Hey now. What's so wrong with that? :p :lol:
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back