Home > Backend Development > PHP Problem > What do the variables in php start with?

What do the variables in php start with?

(*-*)浩
Release: 2023-02-23 17:50:02
Original
11201 people have browsed it

What do the variables in php start with?

All variables in PHP start with "$"

$a=5;
$b=6
Copy after login

php variable naming rules (recommended Learning: PHP programming from entry to proficiency)

1. Case sensitive

$A and $a$ are two different variables, (system built-in structure and Keywords, user-defined class and function names are case-sensitive).

2. The variable starts with the $ symbol, followed by the name of the variable.

3. Variable names must start with letters or underscores and cannot start with numbers.

4. Variable names can only contain alphanumeric characters and underscores (A-z, 0-9 and _)

If the variable is composed of letters, all lowercase is usually used as the variable name. If the variable is made up of multiple characters, use all lowercase letters for the first letter and capitalize each subsequent letter.

The following variable naming is correct:

<?php
$thisCup="onik";
$_class=&#39;roof&#39;;
?>
Copy after login

The above is the detailed content of What do the variables in php start with?. 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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template