1. Declaration of constants
In PHP, define constants using the Define () function to implement
2. Magic Constants
| < td="">
| < td="">
| < td="">
Returns the current line number in the file |
| __file__ |
Returns the full path and filename of the file |
| __dir__ |
Returns the directory where the file resides |
| __function__ |
Returns the name of the function when it is defined |
| __class__ |
Returns the name of the class when it is defined |
| __mthod__ |
Returns the name of the method to which the class was defined |
| < td="">
| < td="">
The test code is as follows:
< span="">
< span=""> < span="">< span="">< span=""> < span="">'The name of this function is: '. < span="">< span="">< span="">< span="">< span="">< c27>< span=""> '
This is the first '. < span="">.' Yes. '< span="">< span="">< span=""> '
The absolute path to this file is: '. < span="">< span="">< span="">< span="">< span=""> ? >
3. Reference Assignment
Access the same variable content with a different variable name, and the other changes as the value of one of the variables changes.
4. Logical operators
With && or | | Non -! XOR
< span="">
< span=""> < span="">=< span="">< span="">< span="">< span="">=< span=""> < span="">< span="">< span="">< span="">(< span=""> < span="">); < span=""> '
'< span="">< span="">< span="">(< span="">< span="">); < span=""> '
'< span="">< span="">< span="">(< span="">< span="">); < span=""> '
'< span="">< span="">< span="">(! < span="">); < span=""> '
< span=""> ' ?>< span="">
5. Comparison operators
① equals = = $a = = $b when a value of $ A equals the value of $b, returns True, otherwise false
② congruent = = = $a = = = $b when a value of $ A equals the value of $b, and $ A is equal to the type of $b, returns True, otherwise false
③ Range! = or <>
④ not congruent! ==
6. Bitwise operators
| < td="">
| < td="">
| < td="">
| Bitwise-AND |
& |
is 1 position 1, the rest is 0 |
| Bitwise OR |
| |
There is a position of 1 for 1 and the rest to 0 |
| Bitwise XOR OR |
^ |
Different positions are 1 and the rest is 0 |
| Bitwise non- |
~ |
1 of the position is 0,0 position is 1 |
| Move left |
<< |
BITS move n times to the left, which is equal to 2 times each move |
| Move right |
>> |
BITS move n times to the right, which is equivalent to dividing by 2 per move |
< span=""> < span="">=123< span=""> =321< span="">< span=""> < span=""> < span=""> < span=""> ' $a & $b = < span=""> '. ( < span=""> & < span=""> ). '
< span=""> " < span=""> $a |< span=""> $b = '. (< span=""> | < span="">).'
< span=""> " < span=""> $a ^ $b = '.< span=""> (< span=""> ^ < span="">).'
< span=""> " < span=""> ~ $a = '.< span=""> (~< span="">).'
< span=""> "< span=""> $a <<4= ." < span=""> (< span=""><<4). '
< span=""> "< span=""> $b >>4= ." < span=""> (< span="">>>4). '
< span=""> ' ?>< span="">
7. String operators
(.) and (. =) and {}
8. Array operators (omitted)
9. Type operator
Type operators are commonly used by instanceof to determine whether a variable belongs to an instance of a class.
< span="">
< span=""> < span="">< span="">< span=""> < span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">=< span="">< span="">< span="">< span="">((< span=""> instanceof A)); < span=""> '
< span="">'< span=""> (( instanceof B));< span="">< span=""> < span=""> '
< span=""> ' ?>< span="">
10. Error control operator @
http://www.bkjia.com/PHPjc/626587.html www.bkjia.com true http://www.bkjia.com/PHPjc/626587.html techarticle 1. Declaration of constants in PHP, define constants using the Define () function to implement 2. Magic constant Returns the current line number in the file __file__ returns the full path and file name of the file __dir ...