PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 200?, PHP 5.3.0 Alpha 4
+- Added optional sorting type flag parameter to array_unique(), default is
+ SORT_REGULAR. (Andrei)
- Changed opendir(), dir() and scandir() to use default context when no context
argument is passed. (Sara)
- Changed open_basedir to allow tightening in runtime contexts. (Sara)
echo "\n-- Testing array_unique() function with more than expected no. of arguments --\n";
$input = array(1, 2);
$extra_arg = 10;
-var_dump( array_unique($input, $extra_arg) );
+var_dump( array_unique($input, SORT_NUMERIC, $extra_arg) );
echo "Done";
?>
-- Testing array_unique() function with zero arguments --
-Warning: array_unique() expects exactly 1 parameter, 0 given in %s on line %d
+Warning: array_unique() expects at least 1 parameter, 0 given in %s on line %d
NULL
-- Testing array_unique() function with more than expected no. of arguments --
-Warning: array_unique() expects exactly 1 parameter, 2 given in %s on line %d
+Warning: array_unique() expects at most 2 parameters, 3 given in %s on line %d
NULL
Done
$iterator = 1;
foreach($inputs as $input) {
echo "-- Iteration $iterator --\n";
- var_dump( array_unique($input) );
+ var_dump( array_unique($input, SORT_STRING) );
$iterator++;
}
5 => $value4
);
-var_dump( array_unique($input) );
+var_dump( array_unique($input, SORT_STRING) );
echo "Done";
?>
array(1, 2, 3, 1)
);
-var_dump( array_unique($input) );
+var_dump( array_unique($input, SORT_STRING) );
echo "Done";
?>