To start off the tutorial you must have a web host or your own server with php enabled. This will host all your php files so you can see if they are working correctly.
STARTING THE PHP CODE
We will start off from the beginning. Php stands for "Hypertext Preprocessor". This means it processes the text before HTML makes it look nice. The Php code can be embedded in an HTML page. To do that you must save the page(s) in a .php extension. Using the code
at the opening of the php code and
at the end of the php code it tells the server that to parse that part of the code using php.
There are many functions that you can use in php. I'm going to introduce you to a basic one called "echo". Echo displays the text you tell it to. If you were to put
echo "hello world!";
in your php code then it would say "hello world!" on the page. If you want your page to only say that then you would put this as your code
echo "hello world!";
You must remember to put the semicolon after each echo because it tells the php parser to end the line. If you don't end the line after a function it will draw an error that will say something like "; expected on line <linenumber>". To echo a variable you would put
. This would display the value of the variable. If you wanted to put both text and variable(s) you would need to have this code
echo "text and " + $variable;
. This would display the value text and whatever the value of $variable is.
To define a varible you simply put "$" then the name you want to call the variable such as "a". That varible would be called "$a". When using it you must refer to it as "$a". "$A" is a completely different variable and would draw errors if you were referring to "$a" or it would screw your end result up. To give a variable a value you would use this code
. This would make the variable "$a" have the value of 1. If the value is another variable you would put this
. This would mean that the value of "$a" is equal to "$A". Again you must have the semicolon after for the same reason as the echo function.
I will make more tutorials about php when I have the time to write them. For now this is what you can start with.