title: php, to return all the elements in an integer array which bigger than a integer stored in a variable
body: <p>ell, my first thought was to use array_filter function looks something like this:</p>
  
  <pre><code>function gettime(){
  
  
  $cityciqurechangetime = an array of integers;
  $iniFirstLegEndTime = an integer calculated by other methods;
  
  $CitySquareTimearray = array_filter($cityciqurechangetime, 
                                     function($n){global $iniFirstLegEndTime ;
                                     return $n &gt;= ($iniFirstLegEndTime);});
  
  return $CitySquareTimearray;
  
  }
  </code></pre>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <pre><code>$initStartTimearray = array_filter($starttimetabletime, 
                                      function($n) 
                                      {return $n &gt;= time();});
  </code></pre>
  
  <p>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.</p>