April 2026
Intermediate
1009 pages
34h 15m
English
A variable stores a value. This value can be changed in the course of a script, so it is variable, giving the variable its name.
In PHP, all variables begin with the dollar sign ($).[ 31 ] Unlike other programming languages, PHP does not require a variable to be declared the first time it appears. But you must of course assign a value to a variable. This can be done with the equals sign (=), the so-called assignment operator. The following therefore assigns a character string with the content "value" to the variable text.:
$text = "Value";
Strings are always written in quotation marks. However, strings are not the only data types that a variable can accept. PHP also distinguishes between the following data ...
Read now
Unlock full access