Use of php basic learning variables

Source: Internet
Author: User
For more information about the use of php basic learning variables, see.

For more information about the use of php basic learning variables, see.

The Code is as follows:
// Reference
$ One = "test ";
Two = & $ one; // equivalent to the transfer address. The two variables point to an address.

// Dynamic variables
$ One = "######";
$ Two = "one ";
$ Three = "two ";

Echo $ three ."
"; // Output" two"
Echo $ three ."
"; // Output" one"
Echo $ three ."
"; // Output "######"

// Php has eight types
// Four scalar types: int integer
// Bool boolean
// Float, double, real
// String
// Two composite types: array
// Object
// Two special types: resource
// Null


// Integer Declaration
$ Int = 10; // decimal Declaration
$ Int = 045; // octal Declaration
$ Int = 0xff; // hexadecimal Declaration
$ Float = 3.14E + 5; // scientific notation
$ Float = 3.14E-5;

// When all values are false
$ Bool = false;
$ Bool = 0;
USD bool = 0.000;
$ Bool = null;
$ Bool = "";
$ Bool = "";
$ Bool = "0 ";
$ Bool = array ();

// String Declaration
// 1. single quotation marks and double quotation marks can both declare strings
// 2. The declared string has no length limit
// 3. In a double quotation mark string, both variables can be parsed directly and escape characters can be used directly (the single quotation mark itself can be escaped or the Escape Character "\" can be escaped "\")
// 4. Variables cannot be parsed directly or escape characters in single quotes.
// 5. You cannot use double quotation marks in double quotation marks.
// 6. It is best to use single quotes,
$ Str = 'aaaaa ';
$ Str = "aaaa ";
// The delimiters declare strings, a large number of strings
// Test is a custom string, which cannot contain any characters or spaces.
// It must end with the custom string "test". No character is allowed before the end.
$ Str = < This write content ......
Test;
>

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.