Variables are used for storing values – such
as numbers or strings – so that they can be used several times in a script. All variables
in PHP start with a dollar sign ($) and are case sensitive. The name can include underscores
characters and numbers, but it cannot start with a number. PHP variables are not declared explicitly.
Instead, they are declared automatically the first time they’re used. It’s a loosely typed
language, so we don’t specify the data type of the variable. PHP automatically converts
the variable to the correct data type – such as strings, integers or floating numbers.
As for boolean values, the keywords true and false can be used. Finally, an undefined variable
has the value null. This can also be set with the NULL keyword. To print a value we just
need to echo the variable name, like this.

PHP Tutorial – 03 – Variables
Tagged on:                                                                                                                                                         

Leave a Reply

Your email address will not be published. Required fields are marked *