Home  >  Article  >  Backend Development  >  What does $ mean in PHP?

What does $ mean in PHP?

Guanhui
GuanhuiOriginal
2020-06-06 11:46:388978browse

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;
?>

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!

Statement:
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