What Are Variables?
Variables, in short, are widgets used to temporarily store values. These values can be numbers, text, or much more complex arrangements. They exist at the heart of any programming language and comprehending them is key to using PHP.
According to the PHP manual, there are eight types of variables in the language. These include four scalar (single-valued) types—Boolean (TRUE or FALSE), integer, floating point (decimals), and strings (text); two nonscalar (multivalued)—arrays and objects; plus resources (which you’ll see when interacting with databases) and NULL (which is a special variable that has no value).
Regardless of what type you are creating, all variables in PHP follow certain syntactical rules:
A variable’s name must ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access