Assignment (Was Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)
| From: | tedd | Date: | Tue, 23 Dec 2008 15:25:13 +0000 |
| Subject: | Assignment (Was Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index) | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285007@lists.php.net to get a copy of this message | ||
At 9:10 AM +1100 12/23/08, Clancy wrote:
Schlossnagle (in "Advanced PHP Programming") advises: $i = 0; while ($i < $j) { ........ ++$i; } rather than: $i = 0; while ($i < $j) { ....... $i++; } as the former apparently uses less memory references. However I find it very hard toTwo things: 1. One statement, one line. 2. The code between the two examples is different; produces different results; and thus is rather pointless in making a definitive comparison. Assignment, demonstrate a correct way to test ++i vs i++. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com