title: Timeout a function in PHP
body: <p>Is there a way to timeout a function? I have 10 minutes to perform a job. The job includes a for loop, here is an example:</p>
  
  <pre><code>&lt;?php
  foreach($arr as $key =&gt; $value){
     some_function($key, $value); //This function does SSH and SFTP stuff
  }
  ?&gt;
  </code></pre>
  
  <p>$arr has 15 elements and some_function() sometimes may take more than 1 minutes. In fact once it got hanged for 5 minutes.</p>
  
  <p>Is there a way I can timeout the function call and move on with next element in $arr?</p>
  
  <p>Thank you!!</p>