|
|
|
รบกวนด้วยครับ จะสอบถามเกี่ยวกับการเปรียบเทียบ array 2 ตัวครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
$array1 = array("a" => "green", "red", "blue", "red", "pink");
$array2 = array("b" => "yellow", "green", "red", "gray");
$result = array_diff($array1, $array2);
print_r($result);
?>
|
|
|
|
|
Date :
2012-03-21 11:14:26 |
By :
Krungsri |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อันนี้ตรงกันข้ามครับ
Code (PHP)
<?php
$array1 = array("a" => "green", "red", "blue");
$array2 = array("b" => "green", "yellow", "red");
$result = array_intersect($array1, $array2);
print_r($result);
?>
|
|
|
|
|
Date :
2012-03-21 18:34:16 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณสำหรับคำตอบครับ จะลองดูครับ
|
|
|
|
|
Date :
2012-03-25 11:00:47 |
By :
altrakung |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|