• Steam recently changed the default privacy settings for all users. This may impact tracking. Ensure your profile has the correct settings by following the guide on our forums.

[PHP]Basics lesson 1

Darkchild

The Doctor
Hey, I know a little PHP and want to teach you (I noticed interest when I say X3sphere's post! :D)

so here we go!

First of all, you will need a PHP server to run the code, a plain computer won't do UNLESS it has Apache or similar software with a PHP Server installed...

here are some choices:
AppServ (Package of MySQL and PHP servers, ONLY FOR MEDIOCRE USERS!)
SimplePHP (This one is more noob friendly, if you are starting to learn PHP, I recommend this one!)
Apache (This one is for ADVANCED USERS, Not Recommended! but all above servers seem to be based off this one)

Anyways!! let's start!

What is PHP?
PHP is the C++ of the web! It's a very advanced structure of programming! Through it, your webpage is processed not only on your computer but also on the server itself! (That means that the server is the one who will need the support for PHP) And Through PHP you can make ONLINE APPLICATIONS for example, this here forum is MADE in PHP, it IS considered an application!

Ok I hope that cleared some things! :D

Now, after you install one of the servers above on your computer open your favourite Internet Browser and go to "localhost" or "127.0.0.1" and it will access the internal PHP server =)

in it you can start making your PHP/html page! :D

Now for the part you've all been waiting for...THE CODE!

Ok...PHP is a VERY organized language I must say! you can have scripts in various files and "link them" all in one =) but that I will teach y'all later =)

if you read my HTML tutorial you will know what tags are, and to make one or more commands of php on a webpage (be it a PHP file or an HTML file) you need to start with these tags:

PHP:
<?php 

?>

The part with the "<?php" starts the PHP! after it you can start typing the code!

Note: In PHP, like c++ and Pascal, all commands must end with a ";" ok? good! :D

now let's do a hello world PHP!

PHP:
<?php  echo'Hello World!';  ?>


Ok here's the syntax:

Echo is the command
'hello world!' is the string that is going to be presented in the page itself.

NOTE: The text you put there, will LITERALLY BE PUT IN THE HTML! if you put tags and etc...he WILL execute them!

and as you probably noticed there is a ";" at the end which concludes the command!

well...that is all...in case of questions...do post!
 
Top