The use of PHP Basic learning variables

Source: Internet
Author: User
Tags array bool variables resource variable type null
Copy CodeThe code is as follows:
<?php
Reference
$one = "Test";
two=& $one;//equivalent to address, two variables to an address

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

echo $three. " <br>/Output "two"
echo $ $three. " <br>/Output "one"
echo $$ $three. " <br>/Output "######"

There are 8 types in PHP
4 kinds of scalar: int integer
BOOL Boolean
Float,double,real
String
2 Types of composite: array
Object
2 Special types: Resource type Resource
Empty type null


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

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

The declaration of a string
1. Single and double quotes can declare strings
2. The declared string has no length limit
3. In a double quote string, you can either parse the variable directly or use the escape character directly (you can escape the single quotation mark itself, or you can escape the escape character "\")
4. In a single quote string, you cannot parse a variable directly, or you can use an escape character
5. Double quotes can no longer be used in double quotes, single quotes cannot be used again
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, nor can spaces
You also want to end with test this custom string, no characters before ending
$str =<<<test
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.