What does $ mean in PHP?

Guanhui
Release: 2023-04-08 18:34:02
Original
8914 people have browsed it

What does $ mean in PHP?

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

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!

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!