The array class function of PHP4 has more than three new members;
They are: Array_unique (), Array_intersect () and Array_diff ().
As the name implies, these three functions are simple:
1. Array_unique (array array)-------remove duplicate elements from the array and return the array
eg
$arr = Array ("A", "B", "C", "B");
$arr = Array_unique ($arr);
Var_dump ($arr); ----Display $arr contains only three elements "a", "B", "C"
2. Array_intersect (array array1,array,array2 ...)----returns elements that are common in multiple arrays as an array
eg
$arr 1 = Array ("A", "B", "C", "D");
$arr 2 = Array ("E", "F", "B", "a");
$arr = Array_unique ($arr);
Var_dump ($arr); ----Display $arr contains two elements "a", "B"
3. Array_diff (array array1,array array2)-----Returns an array of elements that are array1 compared to array2.
eg
$arr 1 = Array ("A", "B", "C", "D");
$arr 2 = Array ("E", "F", "B", "a");
$arr = Array_unique ($arr);
Var_dump ($arr); ----Show $arr contains two elements "C", "D" I feel php4 more humane.
http://www.bkjia.com/PHPjc/532008.html www.bkjia.com true http://www.bkjia.com/PHPjc/532008.html techarticle the array class function of PHP4 has three new members: Array_unique (), Array_intersect (), and Array_diff (). As the name implies, these three functions are simple: 1. Array_ ...