Detailed description of comparison operators in php. 1. for arrays $ aarray (1, 2, 3, 6); $ barray (1, 2, 3, 6, 8); echon; var_dump ($ a $ B ); var_dump ($ a $ B); result: booleanfalsebooleanfalsebooleantrueps: Has
1. for arrays
$ A = array (1, 2, 3, 6 );
$ B = array (1, 2, 3, 6, 8 );
Echo "\ n ";
Var_dump ($ a> $ B );
Var_dump ($ a = $ B );
Var_dump ($ a <$ B );
Result:
Boolean false
Boolean false
Boolean true
Ps: the array with fewer members is small.
$ A = array (1, 2, 3, 6, 9 );
$ B = array (1, 2, 3, 6, 8 );
Echo "\ n ";
Var_dump ($ a> $ B );
Var_dump ($ a = $ B );
Var_dump ($ a <$ B );
Boolean true
Boolean false
Boolean false
Ps: case-by-case comparison
$ A = array (1, 2, 3, 6, 'B' => 3 );
$ B = array (1, 2, 3, 6, 8 );
Echo "\ n ";
Var_dump ($ a> $ B );
Var_dump ($ a = $ B );
Var_dump ($ a <$ B );
Boolean false
Boolean false
Boolean false
Ps: If the key in Operation Number 1 does not exist in Operation number 2 and the array cannot be compared, false is returned.
2. Comparison between bool or null and other types
Var_dump (bool) (null); // boolean false // false when the value of null is converted to bool;
Convert null and other types to bool, and then compare, and FALSE <TRUE
Outputs $ a = array (,); $ B = array (, 8); echo "\ n"; var_dump ($ a $ B ); var_dump ($ a ==$ B); var_dump ($ a $ B); result: boolean false boolean true ps:...