note 119261 added to control-structures.while

From: Date: Thu, 28 Apr 2016 17:35:27 +0000
Subject: note 119261 added to control-structures.while
Groups: php.notes 
Request: Send a blank email to php-notes+get-205392@lists.php.net to get a copy of this message
<?php // test While Vs For php 5.6.17 $t1 = microtime(true); $a=0; while($a++ <= 1000000000); $t2 = microtime(true); $x1 = $t2 - $t1; echo PHP_EOL,' > while($a++ <= 100000000); : ' ,$x1, 's', PHP_EOL; $t3 = microtime(true); for($a=0;$a <= 1000000000;$a++); $t4 = microtime(true); $x2 = $t4 - $t3; echo PHP_EOL,'> for($a=0;$a <= 100000000;$a++); : ' ,$x2, 's', PHP_EOL; $t5 = microtime(true); $a=0; for(;$a++ <= 1000000000;); $t6 = microtime(true); $x3 = $t6 - $t5; echo PHP_EOL,' > $a=0; for(;$a++ <= 100000000;); : ' , $x3, 's', PHP_EOL; //> while($a++ <= 100000000); = 18.509671926498s // //> for($a=0;$a <= 100000000;$a++); = 25.450572013855s // //> $a=0; for(;$a++ <= 100000000;); = 22.614907979965s // =================== //> while($a++ != 100000000); : 18.204656839371s // //> for($a=0;$a != 100000000;$a++); : 25.025605201721s // //> $a=0; for(;$a++ != 100000000;); : 22.340576887131s // =================== //> while($a++ < 100000000); : 18.383454084396s // //> for($a=0;$a < 100000000;$a++); : 25.290743112564s // //> $a=0; for(;$a++ < 100000000;); : 23.28609919548s ?> ---- Server IP: 72.52.91.14 Probable Submitter: 77.144.221.77 ---- Manual Page -- http://php.net/manual/en/control-structures.while.php Edit -- https://master.php.net/note/edit/119261 Del: integrated -- https://master.php.net/note/delete/119261/integrated Del: useless -- https://master.php.net/note/delete/119261/useless Del: bad code -- https://master.php.net/note/delete/119261/bad+code Del: spam -- https://master.php.net/note/delete/119261/spam Del: non-english -- https://master.php.net/note/delete/119261/non-english Del: in docs -- https://master.php.net/note/delete/119261/in+docs Del: other reasons-- https://master.php.net/note/delete/119261 Reject -- https://master.php.net/note/reject/119261 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205392) next »