<?php
Header ("Content-type:text/html;charset=utf-8");
/*
Variable
X/3 =? X?
X + y = 10 9
a2 + b2 = C2
Variables are variable quantities.
Loading and writing containers
Allows you to assign values to a short, easy-to-remember name in the program, now or in the future, for subsequent use
Declaration of PHP variables
Must start with $, followed by the variable name
Use assignment operator = To assign a value to a variable, ending with a semicolon
*/
$ Variable name = ' value '; Chinese naming is not recommended
echo $ variable name;
/*
Naming conventions and characteristics of variables
1. Variable names are numbered, alphabetic, underlined, and cannot begin with a number.
2. There can be no spaces in the middle of the variable name, or a little separation
3. Variable names are strictly case-sensitive
4. Variable can be assigned repeatedly
$this Special variable, it cannot be assigned a value
About naming suggestions for variable names
1. Variable names must be meaningful, can be used in Chinese, but not recommended!!!!
2. Avoid using the PHP keyword as the variable name: p163 table 7-1
3. Variable names use multiple words, using small hump nomenclature funcnameagesex
*/
Echo '
A valid variable name
$a = 10;
$b = 100;
$_love = 456789;
$data = 888888888888888888888888888888888888888888888888888888888888888888888888888888;
Echo $data;
Not legal
$1ABC = 456;
$s. B = 88;
$a b = 123465;
Echo ' <br> ';
Case sensitive
$ABC = 123;
$ABC = 456;
Echo $abc;
Echo ' <br> ';
Echo $ABC;
Echo ' Duplicate Assignment
$a = 1;
$a = 2;
$a = 6666;
echo $a;
$this = 666;
?>
PHP second day variable rule