Home > Article > Backend Development > What does the $ symbol mean in php
The $ symbol in php means variables. PHP uses the syntax of C language, but there are some differences. The $ symbol plus a string is a variable source name or object name.
[Related learning recommendations: php programming (video)]
php中$ The symbol means:
$
The symbol means: variable
PHP uses the syntax of C language, but there are some differences. $
symbol plus a string, this is a variable source name or object name.
MyClass is a class name, no need to add $ sign. $_val is a private variable, usually composed of $ followed by an underscore and a string. foo and foo1 are two member functions. There is no need to add the $ sign, $my is an object, and the $ sign must be added.
Extended information:
Like C language, PHP also has the ternary operator "?:". Its operating mechanism is as follows:
(expr1)?(expr2):(expr3)
Expr1, Expr2 and Expr3 are all expressions. When the expression Expr1 is true, the following Expr2 is executed, otherwise Expr3 is executed. It is not difficult to see from the analysis that the ternary operator "?:" is actually a simplified version of if...else.
PHP assignment operator The PHP assignment operator is used to write values to variables. The basic assignment operator in PHP is "=". This means that the right-hand assignment expression sets the value of the left-hand operand.
[Related learning recommendations: php graphic tutorial]
The above is the detailed content of What does the $ symbol mean in php. For more information, please follow other related articles on the PHP Chinese website!