PHP Learning variables using the _php tutorial

Source: Internet
Author: User
Tags type null
Copy CodeThe code is as follows:
Reference
$one = "Test";
two=& $one;//equivalent to address, two variables point to an address

Dynamic variables
$one = "######";
$two = "one";
$three = "both";

echo $three. "
";//Output" "
echo $ $three. "
";//Output" one "
echo $$ $three. "
";//Output" ###### "

There are 8 types in PHP
4 scalar types: int integer
BOOL Boolean
Float,double,real
String
2 Composite types: Array
Object
2 Special types: Resource type Resource
Empty type null


Declaration of integers
$int = 10; Decimal declaration
$int =045;//Octal statement
$int =0xff;//Hex Declaration
$float =3.14e+5;//Scientific Counting method
$float =3.14e-5;

It's all a false case.
$bool =false;
$bool = 0;
$bool = 0.000;
$bool =null;
$bool = "";
$bool = "";
$bool = "0";
$bool =array ();

Declaration of a string
1. Both single and double quotation marks can declare a string
2. The declared string has no length limitation
3. In a double-quoted string, you can either parse the variable directly, or you can use the escape character directly (you can escape the single quotation mark itself, or you can escape the escape character "\")
4. In a single-quoted string, you cannot parse the variable directly or use an escape character
5. Double quotes are no longer used in double quotes, and single quotation marks are no longer used in single quotes
6. It is best to use single quotes,
$str = ' AAAAA ';
$str = "AAAA";
Delimiter declaration string, large number of strings
Test is a custom string that cannot be followed by any characters, and spaces cannot be
Also ends with a custom string of test, which cannot have any characters before the end.
$str =<< This write content ...
Test;
?>

http://www.bkjia.com/phpjc/323473.html www.bkjia.com True http://www.bkjia.com/phpjc/323473.html techarticle Copy code code as follows:? PHP//reference $ one= "Test"; two= $one;//equivalent to address, two variables point to an address//dynamic variable $one = "######"; $two = "one"; $three = "both"; Echo $t ...

  • 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.