What does $ in php mean?

烟雨青岚
Release: 2023-04-08 21:04:01
Original
6576 people have browsed it

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();
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!