note 85947 added to function.in-array
| From: | alishahnovin at hotmail dot com | Date: | Thu, 25 Sep 2008 23:02:54 +0000 |
| Subject: | note 85947 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144715@lists.php.net to get a copy of this message | ||
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...
----
Server IP: 64.71.164.2
Probable Submitter: 131.107.0.102
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/85947
Del: integrated -- https://master.php.net/note/delete/85947/integrated
Del: useless -- https://master.php.net/note/delete/85947/useless
Del: bad code -- https://master.php.net/note/delete/85947/bad+code
Del: spam -- https://master.php.net/note/delete/85947/spam
Del: non-english -- https://master.php.net/note/delete/85947/non-english
Del: in docs -- https://master.php.net/note/delete/85947/in+docs
Del: other reasons-- https://master.php.net/note/delete/85947
Reject -- https://master.php.net/note/reject/85947
Search -- https://master.php.net/manage/user-notes.php