Home > Backend Development > PHP Tutorial > What symbol starts with when declaring variables in php?

What symbol starts with when declaring variables in php?

下次还敢
Release: 2024-04-29 09:45:23
Original
592 people have browsed it

Declaring variables in PHP starts with a dollar sign ($). Other considerations include: variables are case-sensitive, can only contain letters, numbers, and underscores, cannot start with a number or contain spaces/special characters, and cannot use reserved words as variable names.

What symbol starts with when declaring variables in php?

Symbols for declaring variables in PHP

In PHP, variable names start with a dollar sign ($).

Example:

<code class="php">$name = "John";
$age = 30;</code>
Copy after login

Other notes:

  • Variable names are case-sensitive, i.e. $name and $NAME is a different variable.
  • Variable names can only contain letters, numbers, and underscores (_).
  • Variable names cannot start with numbers.
  • Variable names cannot contain spaces or special characters.
  • Reserved words (such as true, false, null, etc.) cannot be used as variable names.

The above is the detailed content of What symbol starts with when declaring variables in php?. For more information, please follow other related articles on the PHP Chinese website!

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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template