Hi
Long time no write, yesterday a write, feel or someone to see, at least there are one or two comments ~ ~ Good dry!
There are 4 things that need to be adhered to every day: write this, learn a little French, read a book, exercise. A single dog is also good.
1. PHP
First, PHP Foundation (ii)
1.3 Data types
8 Kinds of--4 scalar: Boolean boolean, Integer integer, floating point float/double, string string;2 Compound: Array, object OBJECT;2 Special: Resource resource,null none;
It is recommended to remember English, in the process of learning, variables are usually named.
PHP is a weakly typed language , meaning that you do not need to declare the type of the variable in advance.
View the type of variable: GetType ();
Judgment type: is_* (), where * is shorthand for various data types.
1.3.1 Boolean
True or false, case-insensitive, and habitually (i) write all lowercase.
Generally do not need to cast to a Boolean value, the system automatically judge; (see example below)
These are considered false:false;0;0.0, empty strings, and the string "0", empty arrays, NULL, SimpleXML objects generated from empty tags (I don't quite understand also, mostly not yet involving XML);
Corresponding to the other are considered for true-- Note,-1, is also true;
<?php
$boola =true;
$boolb =false;
$boolc =null;
$boold =-1;
$boole = "SDKLJF";
Echo GetType ($boola). "
function Isbool ($bool) {
if (is_bool ($bool)) {
echo "You is damn right." It is a Boolean. "." <br/> ";
}else{
echo "Sorry, it's not the this type. Please try again. "." <br/> ";
}
}
Isbool ($boola);
Isbool ($BOOLC);
Isbool ($boold);
Isbool ($boole);
function Booluse ($bool) {
if ($bool) {
echo "It is equal to TRUE." <br/> ";
}else{
echo "It is equal to FALSE". " <br/> ";
}
}
Booluse ($boola);
Booluse ($BOOLC);
Booluse ($boold);
In the above example, it is noted that if the direct judgment is Boolean, the general data type will not be cast, and it will only be automatically and forcibly converted to Boolean when used in judgment of If.
1.3.2 Int
Integral type.
I was wrong... Write half of the boss summoned to work overtime, tomorrow to ensure the completion of the first part of the series (indicating that the evening to see the Tang Man Street of it.) )。
Good night, read the book.
Write well and do well-php Foundation (ii)