Analyze the use of PHP logical operators. PHP is still quite common, so I studied the PHP logical operators and shared them here, hoping to be useful to everyone. PHP is a type of powerful PHP that creates dynamic interactive sites, which is quite common. so I have studied the PHP logical operators and shared them here. I hope they will be useful to you. PHP is a powerful server-side scripting language for creating dynamic and interactive sites.
PHP is free and widely used. At the same time, for competitors such as Microsoft ASP, PHP is undoubtedly another highly efficient option. PHP is extremely suitable for website development. its code can be directly embedded with HTML code. PHP syntax is very similar to Perl and C. PHP is often used together with Apache (web server. However, it also supports ISAPI and runs on Microsoft IIS platform of Windows. String operator, which has two character string operators. The first is the concatenation operator ("."), which returns the string after the left and right parameters are connected. The second is the concatenation of the value assignment operator (". ="), which attaches the parameter on the right to the parameter on the left.
1. string operators
Example:
- php
- $a="Hello";
- $b=$a."World!";
- $a="Hello";
- $a.="World!";
- ?>
The only array operator in PHP is the + operator. It attaches the array on the right to the array on the left, but duplicate key values are not overwritten.
- $a=array("a"=>"apple","b"=>"banana");
- $b=array("a"=>"pear","b"=>"strawberry","c"=>"cherry");
- $c=$a+$b;
- $ar_dump($c);
After the script is executed, the script displays:
- array(3){
- ["a"]=>
- string(5)"apple"
- ["b"]=>
- string(6)"banana"
- ["c"]=>
- string(6)"cherry"
- }
2. PHP logical operators:
PHP logical operators:
$ Aand $ bAnd (logical and) TRUE, if both $ a and $ B are TRUE.
$ Aor $ bOr (logical OR) TRUE, if $ a or $ B is TRUE.
$ Axor $ bXor (logical OR) TRUE, if $ a or $ B is TRUE, but not at the same time.
! $ ANot (logical NOT) TRUE, if $ a is not TRUE.
$ A & $ bAnd (logical and) TRUE, if both $ a and $ B are TRUE.
$ A | $ bOr (logical OR) TRUE. if $ a or $ B is set to TRUE.
"And" and "or" have two different operators because they have different operation priorities.
Bytes. PHP is a strong way to create dynamic and interactive sites...