syntax
variables
strings
operators
conditionals
switches
arrays
loops
functions
form input using $_POST
url input using $_GET
If you know HTML and you want to extend your web design knowledge, php is the next good step (In my personal opinion). Almost every server now supports php, its very simple to learn, and very versatile. You may also consider learning javascript as your next step if your knowledge is limited to HTML.
| <?php ?> |
| <?php $name="Bob"; print "Hello $name"; ?> |
The example above has two lines of code, each ends with a semicolon. The first line puts the word "Bob" into a string variable we called $name, the second line prints "Hello Bob".
How to comment PHP code:
It is very important to comment your code, so when you or someone else goes back to it later, you can easily identify what exactly it does. Here are two ways to comment PHP code:
| <?php // This is a comment on one line ?> |
| <?php /* This is is a multi line comment */ ?> |
Lesson 2 - PHP VARIABLES