Study PHP-02

Source: Internet
Author: User

About variables:

variable type : 1.int shaping is also an integer negative number can be

2.boolean True and False

3.double Exact decimal

4.string string ' Wrap up

5.NULL NULL

6.array Array,

7.object objects

GetType

Variable types can be detected with GetType, Syntax: GetType ($ variable name)

To determine the variable type :

Settype (), Is_array (), Is_bool (), is_float (), Is_integer (), is_null (), is_numeric (), is _object (), Is_resource (), is_scalar () and is_string ()

Print Variables :

echo More for strings

Print_r () Multiple for arrays

Var_dump ()

Variable type conversions

conversion from string to number : From left to right, until the illegal number (English letter) stops, the interception portion is converted to the number int type,

Example: $a = ' 15helloworld ';

$a = $a +3;

echo $a;

This result is (int type)

conversion from a number to a string : with. Direct stitching

Destroying variables

Syntax: unset ($a);

Note : $a = $b, $a still exist after destroying $b! $a = & $b together point to the same address, which is mutual

Dynamic variables

Example: $a = 5;

$b = ' a ';

echo $ $b; Will show 5

Study PHP-02

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.