The PHP language is not very typical, ie a variable can alternatively be a number, string or whatever else! The main data types in PHP (this will not change almost anything for you in terms of syntax, but it is good to know. Note that the variable names used as an example and their values are purely arbitrary. String: the value is delimited by quotes (single or double, it will favor a simple matter of speed):
PHP Code:
<?php
$first_name = 'DuraCell' ;
?>
A number: it removes the quotes this time, it allows PHP to tell that this is a number (either integer or floating):
PHP Code:
<?php
$name = 7 ;
$name = 3.02 ;
?>
A boolean: Boolean variables can take two values: TRUE (true) and false (false). They may be useful to know if such an option is enabled:
PHP Code:
<?php
$view_options = FALSE ; // not display options
$use_cache = TRUE ; // using a cache
?>
Bookmarks