PHP is somewhat like javascript- but run server side rather than on a clients browser. This is useful for changing files/database entries online, but this also requires you to have access to a "server"
To setup your "server", all you need is to have apache running. But there are packages that install everything you need automatically for you- xampp for instance. Download and install xampp to setup your personal server on your computer
Once Xampp is installed, you should be able to see the xampp screen by going typing into the browser: http://localhost - which should be by default located at c:\xampp\htdocs. If you go there from my computer, you should find your "website directory".
Make a new folder in here called: 'website', and go into the folder. Create a new text document, and rename it to: 'index.php'. This is your first php file! Now type in the following:
Php can be used on the same page as html, and can be inserted anywhere in the page. But you have to tell the browser when the php will start and end using <?php and ?>
Next, all variables (names used to represent a value, such as $num1, $num2 in this case) have to have a dollar sign($) on the front always. Here I assigned the $num1 the value of 4, $num2 the value of 7, and $answer a string(words).
In php, it doesn't care if a variable is a whole number/integer, string, or decimal value/float. You can even assign a variable any different type without needing to specify.
Next, I created the variable $total, and assigned it the sum of $num1 and $num2.
Lastly, using the function "echo", I print out the string $answer, joined with the number $variable. Nothing else will be seen by the browser, except what is echoed out.
A period is used to join two variables together, and all that is needed is a period after each variable to add to the string that will be printed out. A semi-colon is needed after every statement.
To see this page, you cannot open it directly from your "my computer"- you must use the browser, with a url such as: http://localhost/website/
For additional resources, check out http://www.php.net, which is an enormous resource for learning php, looking up functions, and using as a reference.
The answer is = 11