Php operator | pseudo class | type conversion

Source: Internet
Author: User
Tags comparison table php operator
Callback indicates the Callback function, which means that the parameter should be an escape character used for defining double quotation marks when a function (function name or anonymous function) is defined as a string:
A pseudo-type uses a type identifier to describe the currently required data type. For example, Mixed indicates that many types are acceptable. But not all types. Number indicates the numeric type (integer and floating point) Callback indicates the Callback function, meaning that the parameter should be a function (function name or anonymous function) Void indicates Null, indicating that the function does not return, or does not accept the parameter. Type conversion: the Php variable type is determined when assigning values to the variable, depending on the current data type. In addition, php variable types can be changed. This type is called a weak type. A strong language is opposite to a weak type, and the variable type is fixed. It should be determined during the declaration. Php is a weak language. When data is involved in the operation, the type is converted according to the conditions required by the operation. This process is called automatic type conversion.
In fact, the data type must be converted to the same before the operation between multiple operation data involved in the operation.
Such a relationship as above does not need to be considered involved in the conversion process, which is called automatic type conversion. In contrast, we can think of a definition that converts a certain data type to a certain data type. this process is called forced type conversion. Method of Force type conversion (type to be converted) $ var;
The conversion operation can write the following type names: · (int), (integer)-converted to integer (integer) · (bool), (boolean) -convert to boolean (float), (double), (real)-convert to float (string)-convert to string (string) · (binary)-convert to binary string (string) (PHP 6) · (array)-convert to array (array) · (object)-convert to object) · (unset)-convert to NULL (PHP 5) the type-related function provided in Php: Var_dump (); print the value and type of the variable. Settype () to convert the data type. Gettype (); obtain the data type of the variable. (It is not recommended to use the is _ type () instead .) Isset () to check whether a variable is defined. Empty (); checks whether a variable is Empty. Array () Unset (); destroys the variable. Operator: arithmetic:
Division:
String operator:. Point string connector.
Assignment Operator = assign the value on the right of the equal sign to the left. Generally, the assignment operator can work with other operators to perform self-calculation. the assigned variable itself participates in the operation... = String self-join
+ = Add your own budget:
Comparison operator-result returned by relational operators? Boolean. Equal to the two sides of the operator can be equal = not equal to the two sides of the operator is not equal to the value is not equal! = <> Greater than or equal to> = less <小于等于 <=全等 值与类型同时相等才可以 ===不全等 只要 值 或者 类型不同 即为 不全等 !== 
Logical operators: operations between multiple links. False or false
Only when both conditions are true can two operators be true: & and
If both conditions are false, the result is false. otherwise, at least one condition is true and the result is true. | Or
If the two conditions are not the same, the result is: if the same result is false: xor
And or both support short-circuit operations. And &: If the first operator involved in the operation is false, is it necessary to judge the second operator? No. Or |: If the first operator involved in the OR operation is true, the second operator is also unnecessary. For example, defining constant operations:
Bitwise operator: the result of our operation is the result of each bitwise of binary. &
|
^ Bitwise OR
~ Bitwise inversion
<Left shift is equivalent to x2
> The right shift is equivalent to/2.
Job: view the type comparison table,
Test the functions and differences between (boolean) $ x and empty ($ x) isset ($ x); the integer function, floor () ceil () round. $ A = 'abc'; if ($ a = 0) {echo 'Yes;} else {echo 'no ';}

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.