How to set timeout for specific executions in PHP?
<p>What I am trying to do is, I am running queries against Twitter and if the deliver of the result delays more than a specific time, than I want to say to user that "Please try again later, timeout." I am not asking the Twitter part, I told my story because of the initial explanation but I like to learn how to accomplish it with mostly PHP native codes.</p>

<p>What's in my mind would be something below:</p>

<pre><code>startTimeout(callback(),3000);//Probably this function needs to start a new thread or another concurrent execution scope
//... initiating some twitter queries here

function callback()
{
   echo "Time out, sorry";
}
</code></pre>
