note 98823 added to language.operators.increment
| From: | g dot nicolas_89 at hotmail dot fr | Date: | Fri, 09 Jul 2010 15:28:45 +0000 |
| Subject: | note 98823 added to language.operators.increment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170830@lists.php.net to get a copy of this message | ||
Note that pre or post incrementation are faster than incrementation by "normal" way
//Starting expression
Expression : $a= 0;
//Key legend
0 for $a++
1 for ++$a
2 for $a+=1
3 for $a = $a + 1
For 2000 iterations :
Test #1 : Array ( [0] => 0.0378229618073 [1] => 0.0375590324402 [2] => 0.0392827987671 [3]
=> 0.0439450740814 )
Test #2 : Array ( [0] => 0.0372891426086 [1] => 0.0379481315613 [2] => 0.0392479896545 [3]
=> 0.0435540676117 )
Test #3 : Array ( [0] => 0.0382251739502 [1] => 0.0380570888519 [2] => 0.0401508808136 [3]
=> 0.0449271202087 )
Test #4 : Array ( [0] => 0.038330078125 [1] => 0.0389108657837 [2] => 0.0397388935089 [3]
=> 0.0445611476898 )
Test #5 : Array ( [0] => 0.0383379459381 [1] => 0.0385930538177 [2] => 0.0400578975677 [3]
=> 0.044585943222 )
Bad way to use $a = $a + 1 ^^
----
Server IP: 89.31.146.176
Probable Submitter: 85.116.42.193
----
Manual Page -- http://www.php.net/manual/en/language.operators.increment.php
Edit -- https://master.php.net/note/edit/98823
Del: integrated -- https://master.php.net/note/delete/98823/integrated
Del: useless -- https://master.php.net/note/delete/98823/useless
Del: bad code -- https://master.php.net/note/delete/98823/bad+code
Del: spam -- https://master.php.net/note/delete/98823/spam
Del: non-english -- https://master.php.net/note/delete/98823/non-english
Del: in docs -- https://master.php.net/note/delete/98823/in+docs
Del: other reasons-- https://master.php.net/note/delete/98823
Reject -- https://master.php.net/note/reject/98823
Search -- https://master.php.net/manage/user-notes.php