Re: Re: [PEPr] Comment on Networking::Monitor
| From: | Robert Peake | Date: | Thu, 09 Dec 2004 18:31:36 +0000 |
| Subject: | Re: Re: [PEPr] Comment on Networking::Monitor | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-34970@lists.php.net to get a copy of this message | ||
Thanks, Joe. I don't anticipate any 200K arrays in this package, so I'll change my while()'s to foreach()'s.
Best,
RP
Joe Stump wrote:
It depends on the use. foreach() for small arrays is supposed to be faster than while(list() each()). Also, you don't have to reset() arrays after using foreach(), BUT foreach() makes a *copy* to work on, which can be resource heavy with really large arrays (ie. you'd have two copies of a 200k length array if you used foreach()). This is what I understand to be the differences. Things may have changed since I last looked into this. --Joe On Dec 9, 2004, at 10:04 AM, Robert Peake wrote:Hi Bertrand, Yes -- I will double-check CS before moving to vote. s/if(/if (/g <- my best friend :) Why do you recommend foreach instead of while ... each? Best, Robert Bertrand Mansion wrote:Bertrand Mansion (http://pear.php.net/user/mansion) has commented on the proposal for Networking::Monitor. Comment: This looks good. Could you try to be more consistent in your PHPDoc blocks and fix some CS issues, for example check where you put brakets and parenthesis if () not if(), function () { not function () { Try to use foreach() instead of while (list = each). Proposal information: http://pear.php.net/pepr/pepr-proposal-show.php?id=171-- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php