title: How to run a PHP function after specific time on server?
body: <p>I have a function which adds a new blog post to my database.</p>
  
  <p>After running <strong><em>add_new_post()</em></strong> function the post should be approved by my another function <strong><em>approve_post()</em></strong>.</p>
  
  <p>But I don't want to approve post immediately. I want to run <strong><em>approve_post()</em></strong> function in time between <code>1 to 5 minute (random)</code>.</p>
  
  <p>Now I am using this code:</p>
  
  <pre><code>function add_new_post() {
      *my code of adding post*
  
      $time = rand(60, 300);
      echo $time;
      sleep($time);
  
      approve_post();
  }
  </code></pre>
  
  <p>But browser shows loading until sleep ends. Also, I found that my Windows machine shows time execution error.</p>
  
  <p>Is there a way to run <code>approve_post()</code> function in the background without showing page loading to the browser?</p>
  
  <p>I would be grateful for а code example.</p>