Use of php basic learning variables

Source: Internet
Author: User
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.