note 85947 rejected from function.in-array by thiago
| From: | thiago@php.net | Date: | Thu, 25 Sep 2008 23:09:29 +0000 |
| Subject: | note 85947 rejected from function.in-array by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-144716@lists.php.net to get a copy of this message | ||
Note Submitter: alishahnovin at hotmail dot com
----
To: Kureal at kkooporation dot de
Are you sure about this? I am aware of the reasoning to use ++i over i++, but I've found that
most compilers (I'm not sure about what PHP does...) will interpret ++i, i++, i+=1, i=i+1, all
in the same way - ie. in modern compiled languages, these all are interpreted in the same way
(except when incrementing before or after can cause a difference)
Older languages don't regard them as the same, and thus it can produce different results in
performance, but I think that's largely negligible - particularly when it comes down to the
algorithm at hand. Big O notation....
And if you're dealing with a 1K dimensional array, you should probably focus your optimizations
elsewhere.... like on limiting the dimensions of your array. If you have a 1K dimensional array, of
length 100... you should focus on a better way of managing the data so you can optimize any
functions performed on the array, such that you're not then iterating through such a massive
array. ++i or i++ isn't the only improvement that can be done here...