ell, my first thought was to use array_filter function looks something like this:
function gettime(){
$cityciqurechangetime = an array of integers;
$iniFirstLegEndTime = an integer calculated by other methods;
$CitySquareTimearray = array_filter($cityciqurechangetime,
function($n){global $iniFirstLegEndTime ;
return $n >= ($iniFirstLegEndTime);});
return $CitySquareTimearray;
}
But it's not working, i ran a few tests and the results indicated that the variable $iniFirstLegEndTime has never passed to the callback function in the array_filter() function so the $CitySquareTimearray variable is just the entire array $cityciqurechangetime.
I once thought maybe i shouldn't declare a function in the array_filter() function but the following one works perfectly where $starttimetabletime is an array of time stamps.
$initStartTimearray = array_filter($starttimetabletime,
function($n)
{return $n >= time();});
What i really want is an "sub-array" of $cityciqurechangetime with all element is greater or equal than $iniFirstLegEndTime, please tell me what i did wrong or if there are better ways to solve this problem other than using array_filter() function please teach me, thank you very much.