Abandoned fish--how long does PHP take to get from getting started to giving up? 3

Source: Internet
Author: User
Tags arithmetic operators

today's Course: PHP 3- Day Foundation Consolidation video Tutorial "Yan 18"

variable Type: String, Integer, floating-point number, resource, array, object, NULL, Array

Null type // No value and no type

<?php

$a = null;

?>

detects if a variable exists //isset detection variable, returns false for the null type

if (Isset ($b)) {

echo ' variable b exists ';

}else{

echo ' variable b does not exist ';

}

get the variable type //gettype function

$b = ' 1 ';

Echo GetType ($b);

determine if the type you want is //is_int,is_float,is_array ...

Is_int,is_float,is_array

if (Is_int ($a)) {

echo "A is shaping ";

}else{

echo "A is not cosmetic ";

}

print variable //echo string , Print_r array,var_dump The type of the variable and its value

echo string , Print_r array,var_dump type and value of the print variable

$c = 1;

$d = Array (+/-);

Echo $c;

Print_r ($d);

Var_dump ($d);

Type conversions

$a = 1;

$a = $a. ' Hello ';

echo $a;

to the Boolean type of judgment, the value is considered a Boolean false, while the other refers to the original true:',' 0 ',0,0.0,false, NULL,Array ();

if (' = = False ') {

Echo ' empty string is false ';

}

?>

Assign value

value Assignment,

$a = 9;

$w = 10;

$w = $a;

Var_dump ($a, $w);//29.29

$w = ' W ';

Var_dump ($a, $w);//29.W

Reference Assignment

$a = 9;

$w = 10;

$w = & $a;

Var_dump ($a, $w);//29.29

$w = ' W ';

Var_dump ($a, $w);//w.w

destroy variable // destroyed variable value is NULL

destroyed

$a = 9;

unset ($a);

if (Isset ($a)) {

echo ' variable a exists ';

}else{

echo ' variable a does not exist ';

}

Dynamic Variable Name

Dynamic Variable name

$a = ' Hebei ';

$d = ' a ';

$e = ' d ';

Echo $a, $ $d, $$ $e;

Arithmetic operators

echo ' <br/> ';

$a = 10;

$b = 1;

echo $a/$b;// divisor cannot be 0

echo ' <br/> ';

$a = -10;//10,-10

$b = -3;//3,-3

echo $a% $b;//modulo algorithm, the result is positive or negative depending on the divisor

Tired Today, sleep.

The third day, did not give up, it seems really need to go heart ~ ~ ~


This article from "A Big big waste fish" blog, declined reprint!

Abandoned fish--how long does PHP take to get from getting started to giving up? 3

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.