Home > Article > Backend Development > What does $ in php mean?
PHP is an HTML embedded scripting language. php files end with .php. Much of its syntax comes from C, Java, and Perl, and it has several features unique to PHP. The main goal of the language is to allow web developers to quickly write dynamically generated web pages.
The $ symbol in PHP means: variable
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.
class MyClass{ private $_val; public function foo(){ return $this->_val; } public function foo1(){ return $this->_val; } ...... } $my = new MyClass; echo $my->foo();
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.
Recommended tutorial: "php tutorial"
The above is the detailed content of What does $ in php mean?. For more information, please follow other related articles on the PHP Chinese website!