Starting out with PHP |
Send to Friend Written By: Andrew |
Making sure you have everything
But you can't just put your PHP files anywhere. They have to be on a
server with PHP installed correctly. This means that you can't just view the
files in you're My Documents or something you need to view them though the
web server. If you have no idea how to set up one of these server things or
you want to learn how to set one up maybe you could refer to the other
guide I have created about setting up a web server with Apache, PHP and
MySql
! But hopefully you've already read somewhere that you will need a
server and have already got one!!! If you also want to run databases with
your PHP then you could install MySql. Again see the guide on how to
install!!!
Starting some PHP code
Right, I really hope you already know HTML or you are most probably
going to find this difficult. If you don't please could you check back at the
html tutorials on the site because you will find this hard and you will need
html to help you with this!!!
To start with let's look at some basic PHP code that outputs "Hello
World!" Don't ask me why programmers use Hello World I have no idea
myself!!!
<?
echo "Hello World!";
?>
The code you see above would go in a webpage, maybe halfway
though all the other HTML code on the page, but the page will have the
extension ".php". So if you have <h3> and </h3> around the PHP code it
would output <h3>Hello World!</h3>.
I expect your thinking what is the point of writing Hello World when
you can just type it manually. Well first of all I am going to need to explain
variables first but believe me there is a point to echo!
