What does $ mean in PHP?
$ This symbol is a syntax in PHP. Its function is to define a variable. When defining, you only need to add the variable name after the symbol. When using it, you also need to add the variable name after the symbol. Variable names, PHP's unique syntax is a mixture of C, Java, Perl and PHP's own syntax.
Sample code
<?php $x=5; $y=6; $z=$x+$y; echo $z; ?>
PHP variable rules:
Variables Begins with a $ sign, followed by the name of the variable
Variable names must begin with a letter or an underscore
Variable names cannot begin with a number
Variable names can only contain alphanumeric characters and underscores (A-z, 0-9, and _)
Variable names are case-sensitive ($ y and $Y are two different variables)
#Note: PHP variable names are case-sensitive!
Recommended tutorial: "PHP"
The above is the detailed content of What does $ mean in PHP?. For more information, please follow other related articles on the PHP Chinese website!