How can I supress system() from printing to screen?
<p>Trying to test how long mongo takes to retrieve each document.</p>

<p>However, <code>system()</code> prints the result to screen and I think that may slow down the process.</p>

<p>How could I supress it from printing to screen?</p>

<pre><code>&lt;?php
$m = new MongoClient();
$db = $m-&gt;selectDB("test");
$collection = new MongoCollection($db, "fakestat");
for($i=0;$i&lt;1000;$i++){
        $index[]=rand(1,432050);
}
$fp = fopen('logTime.txt','w');
fwrite($fp, "startTimeSec\t startTimeNanoSec\t endTimeSec\t endTimeNanoSec\n");

foreach($index as $val) {
        $startTime = system("date +%s'\t'%N");
        $results[] = $collection-&gt;findOne(array("capture"=&gt;"$val"));
        $endTime = system("date +%s'\t'%N");
        fwrite($fp, sprintf("%s\t %s\n", $startTime, $endTime));
}
fclose($fp);
$m-&gt;close();
?&gt;
</code></pre>

<p>Update: Using <code>exec()</code> and it seems to be work abeit still rather slow.</p>
