First, PHP statement or code must reside with the within the PHP; start <?php and end ?> block as you have seen in the last example.
<?php .... ?>
Finally PHP is loosely typed language, that is, it determine the data type of a variable at run time when you request the PHP page or function, this is a feature that languages like C, C++, Java, C# and others, strongly discourage, as they insist you must declare every variable before usage, hence they are called strongly typed language. This PHP feature has it advantage and disadvantage, but just as I said earlier Rasmus Lerdorf (creator of PHP) must have taught that most web developer or programmers are also busy with other things therefore saving them from this hustle of declaring all variable with type before usage, we will see the next example Form processing using PHP what I mean.
Although the variable described above is what most people refer to as variable but PHP also other kinds of built-in variable for different types of operation, see the list below
$_POST: holds variables provided through the form POST method
$_GET: holds variables provided through the POST method
$_SESSION: holds any variables that are currently registered in a session
$_SERVER: holds server related information such as headers and file paths
$_FILES: holds any variables provided through file uploads.
$_ENV: handles server environment related variables.
Although PHP has more than this unique variables, but these are the ones we are likely going to be using in the book, most especially the first two or three, this is because the $_POST is often use to collect data from form with POST method, and this is where web application becomes very handy, See the next topic form processing for more.