If you delete an array, the original array a & nbsp; contains the Value & nbsp; $ a = array (a, B, c); compare array B & nbsp; & nbsp; has the value & nbsp; $ B = array (B); for comparison, we can get $ c = & nbsp; array (a, c); Excuse me, how can I delete an array with repeated values?
The value $ a = array (a, B, c) in the original array );
Compare the values of $ B = array (B) in array B );
Get $ c = array (a, c );
How can I do this.
------ Solution --------------------
Loop judgment or removal
------ Solution --------------------
Use array_diff ($ array_a, $ array_ B)
------ Solution --------------------
Array_diff, Array subtraction
------ Solution --------------------
$a = array(a,b,c);
$b = array(b);
print_r(array_diff($a, $b));
Array
(
[0] =>
[2] => c
)
------ Solution --------------------
Reference:
Use array_diff ($ array_a, $ array_ B)
'
------ Solution --------------------
Http://baike.baidu.com/view/4067743.htm
------ Solution --------------------
In fact, you mean to find the difference set of the two arrays. the system function array_diff () is enough.
------ Solution --------------------
The array_diff () manual contains
------ Solution --------------------
Reference:
Use array_diff ($ array_a, $ array_ B)
$ C = array_diff ($ a, $ B );
Echo "c = {";
Foreach ($ c as $ key => $ value)
{
Echo $ value .",";
}
Echo "}
\ N ";
------ Solution --------------------
Reference:
Use array_diff ($ array_a, $ array_ B)
Take a look at the manual functions.