PHP second day variable rule

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.