title: PHP pinging, even 1 request timeout
body: <p>I have been using the script below, however, I want it to ping 3-4 times, and within that 3-4 times if it has even a single request timeout, I want php to come back as failed.</p>
  
  <p>Here's a script I'm using:</p>
  
  <pre><code> &lt;?php
  
  function pingAddressHasNeverFailed($tries) {
      for ($i = 0; $i &lt; $tries; $i++) {
          $pingresult = shell_exec("ping -c 1 www.google.com", $outcome, $status);
          if ($status != 0)
              return false;
      }
      return true;
  }
  
  if (pingAddressHasNeverFailed(3)) {
      echo "uoc gi";
  }
  ?&gt;
  </code></pre>
  
  <p>Please help if you can, thank you so much in advance!</p>