php运算符的关键字,PHP 运算符
關(guān)于數(shù)組:
$ly = array("id" => '1',"username" => 'ly');
$ngcx = array("id" => '2',"username" => 'ngcx');
var_dump($ly + $ngcx);
var_dump($ly == $ngcx);
var_dump($ly === $ngcx);
var_dump($ly <> $ngcx);
var_dump($ly != $ngcx);
var_dump($ly !== $ngcx);
$ly1 = array("id1" => '1',"username1" => 'ly1');
$ly2 = array("id2" => '2',"username2" => 'ly2');
var_dump($ly1+$ly2);
?>
結(jié)果:
array(2) {
["id"]=>
string(1) "1"
["username"]=>
string(2) "ly"
}
bool(false)
bool(false)
bool(true)
bool(true)
bool(true)
array(4) {
["id1"]=>
string(1) "1"
["username1"]=>
string(3) "ly1"
["id2"]=>
string(1) "2"
["username2"]=>
string(3) "ly2"
}
其它的文章中都有,就將一個(gè)文章中沒(méi)有說(shuō)清楚的 a+b 集合(聯(lián)合)單列出來(lái)。
如果兩個(gè)數(shù)組他們的 key 值相同它的返回值會(huì)使用第一個(gè)數(shù)組的 value 值,如果其 key 值不同將會(huì)將他們拼接:
$ly = array("idl" => '1',"usernamel" => 'ly');
$ngcx = array("idn" => '2',"usernamen" => 'ngcx');
var_dump($ly+$ngcx);
echo PHP_EOL;
$ly = array("id" => '1',"username" => 'ly');
$ngcx = array("id" => '2',"username" => 'ngcx');
var_dump($ly+$ngcx);
?>
結(jié)果:
array(4) {
["idl"]=>
string(1) "1"
["usernamel"]=>
string(2) "ly"
["idn"]=>
string(1) "2"
["usernamen"]=>
string(4) "ngcx"
}
array(2) {
["id"]=>
string(1) "1"
["username"]=>
string(2) "ly"
}
南宮晟醺
南宮晟醺
132***4430@qq.com7個(gè)月前 (09-09)
總結(jié)
以上是生活随笔為你收集整理的php运算符的关键字,PHP 运算符的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: php解析doc试卷,PHP试题(卷)带
- 下一篇: php is_post,PHP发送ge