setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); $mysqlo=new MySQLi($host,$user,$pass,$db); $old=mysql_connect($host,$user,$pass); mysql_select_db($db,$old); $t1=array(); $t2=array(); $t3=array(); $t4=array(); echo ''; #MySQLi - procedural //for all while queries: What the hell are those? for($i=0;$i<$results;$i++) { #MySQL $t=microtime(true); $res=mysql_query('SELECT title,created,option1,floatnum,text FROM test',$old); while($array=mysql_fetch_assoc($res)) { echo $array['floatnum'].' - '; } $t1[$i]=microtime(true)-$t; mysql_free_result($res); unset($res,$array); #MySQLi - proceduralny $t=microtime(true); $res=mysqli_query($mysqli,'SELECT title,created,option1,floatnum,text FROM test',MYSQLI_USE_RESULT); while($array=mysqli_fetch_assoc($res)) { echo $array['floatnum'].' - '; } $t2[$i]=microtime(true)-$t; mysqli_free_result($res); unset($res,$array); #MySQLi - obiektowy $t=microtime(true); $res=$mysqlo->query('SELECT title,created,option1,floatnum,text FROM test',MYSQLI_USE_RESULT); while($array=$res->fetch_assoc()) { echo $array['floatnum'].' - '; } $t3[$i]=microtime(true)-$t; $res->free(); unset($res,$array); #PDO $t=microtime(true); $res=$pdo->query('SELECT title,created,option1,floatnum,text FROM test'); $res->setFetchMode(PDO::FETCH_ASSOC); while($array = $res->fetch()) { echo $array['floatnum'].'

'; } $t4[$i]=microtime(true)-$t; $res->closeCursor(); unset($res); unset($array); } #Zestawienie ?>
'; for ($x = 1; $x < 5; $x++) { if($min==${"t$x"}[$i]) { echo ''; } echo ''; } echo ''; for ($x = 1; $x < 5; $x++) { echo ''; //print_r($mmax[$x]); } //print count($mmax[1]); ?>
Count MySQL (proc.) MySQLi (proc.) MySQLi (obj) PDO →
'.++$ii.'.'; if (!isset($minmax['max'][$x])) $minmax['max'][$x] = 0; $minmax['max'][$x] += 1; } elseif($max==${"t$x"}[$i]) { echo ''; if (!isset($minmax['min'][$x])) $minmax['min'][$x] = 0; $minmax['min'][$x] += 1; } else { echo ''; } echo ${"t$x"}[$i]*1000 .' ms
Stats: Avg : '. ($mavg[$x] / $results) . ' ms
Max : '.$minmax['max'][$x] .'
Min : '.$minmax['min'][$x].'
Mid : '.($results - $minmax['min'][$x] - $minmax['max'][$x]).'