php array_diff() fungsi
Hasil terjemahan:
Bahasa Inggeris ['dɪf] AS ['dɪf]
abbr.differential differential (of);difference different;differ different;differentiator differentiator
php array_diff() fungsisintaks
Fungsi: Bandingkan nilai utama dua tatasusunan dan kembalikan perbezaannya
Sintaks: array_diff(array1,array2,array3...)
Parameter:
array1 | |
array2 | |
array3,... | |
php array_diff() fungsicontoh
<?php $class1 = array("西门"=>"55","灭绝"=>"44","无忌"=>"22"); $class2 = array("西门"=>"54","灭绝"=>"44","无忌"=>"25"); print_r(array_diff($class1,$class2 )); //返回两个数组中不一样的元素 ?>e
run Instance »
Klik butang" Run Instance "untuk melihat Instance Online Output:
Array ( [西门] => 55 [无忌] => 22 )e
<?php $per1=array("a"=>"灭绝师太","b"=>"欧阳克","c"=>"西门大官人","d"=>"韦小宝"); $per2=array("e"=>"Peter","f"=>"慕容复","g"=>"陈近南"); $per3=array("a"=>"灭绝师太","b"=>"欧阳克","h"=>"王重阳"); $result=array_diff($per1,$per2,$per3); print_r($result); ?>e
Array ( [c] => 西门大官人 [d] => 韦小宝 )