title: How does 'function' and 'use' and 'array_filter' work in PHP?
body: <p>I am familiar with creating a PHP function placed at the top of the .php file such as:</p>
  
  <pre><code>function my_little_function($parm1,$parm2) {
     if ($parms &lt; $parm2) {
     return "yes";
     } else {
     return "no";
     }
  }
  </code></pre>
  
  <p>Then call it like this:</p>
  
  <pre><code>$result = my_little_function("1","2");
  echo "The answer is $result." . "\n";
  </code></pre>
  
  <p>I have some code, I didn't write it, which uses "function" and "use" together inside of a traditional use of a function like my_little_function above.</p>
  
  <p>I'm puzzled by this and have some questions for you more experienced PHP developers. Here is part of the working PHP code I'm referring to:</p>
  
  <pre><code>$neededObject = array_filter($st_ny_trip-&gt;STOPS-&gt;STOP,function($e) use ($final_desired_dest,$connect_raw){return $e-&gt;NAME == $final_desired_dest &amp;&amp; DateTime::createFromFormat("m/d/Y g:i:s a", $e-&gt;TIME) &gt; $connect_raw;});
  </code></pre>
  
  <p><code>$e</code> is not set in any part of the function or the rest of the program, so what is using <code>$e</code>? How does it get passed a value and how is it being used? There appears to be no name for this function, so I don't know how it is being called, how is that being done?</p>
  
  <p>Is this creating a function, on-the-fly to be used and it gets re-generated each time this code gets called? If it's a function, why not create it outside of this function and call it?</p>
  
  <p>I've also not used 'use' myself yet, so that's unfamiliar to me. I looked it up on php.net and it just looks like a way to assign a value to something, but I couldn't find any practical examples to demonstrate why it's needed and when it should be used.</p>
  
  <p>I looked up <code>array_filter</code> and it says it's "Filters elements of an array using a callback function". I don't know what a call back function is. Is it referring to <code>function($e)</code>?</p>
  
  <p>Should the above line of PHP code for <code>$neededObject</code> be formatted differently so it is easier to read?</p>