I have a line of code that has worked on my local develop machine but does not work (as expected) on another machine.
Here is my debugging of the call to array_unique:
debug("Parameter array size: ".sizeof($parameters));
debug("Sorted array size: ".sizeof(array_unique($parameters, SORT_REGULAR)));
debug_r($parameters);
debug_r(array_unique($parameters, SORT_REGULAR));
(I've coded the debug and debug_r functions to output the input, but nicely formatted.)
The results are:
Parameter array size: 10
Sorted array size: 0
Array ( [0] => ~oli_Search_Term [1] => ~oli_Search_Term [2] => ~oli_Search_Term [3] => ~oli_Search_Term [4] => ~tim_Time_From [5] => ~tim_Time_To [6] => ~tim_Time_From [7] => ~tim_Time_To [8] => ~tim_Time_From [9] => ~tim_Time_To )
Note - there is nothing output for that final debug call (intended to dump the contents of array_unique($parameters, SORT_REGULAR).
Why is the array empty (and only on one machine)?
The machine where the output is empty is running PHP Version 5.0.3.
Adding the following:
vardump($parameters);
... yields:
array(10) { [0]=> string(16) "~oli_Search_Term" [1]=> string(16) "~oli_Search_Term" [2]=> string(16) "~oli_Search_Term" [3]=> string(16) "~oli_Search_Term" [4]=> string(14) "~tim_Time_From" [5]=> string(12) "~tim_Time_To" [6]=> string(14) "~tim_Time_From" [7]=> string(12) "~tim_Time_To" [8]=> string(14) "~tim_Time_From" [9]=> string(12) "~tim_Time_To" }