Re: Are PHP5 features worth it?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Cummings wrote:
> On Wed, 2006-12-20 at 11:49 +0100, Jochem Maas wrote:
>>> How about iterators? You can have objects that look like arrays yet they take
>>> much less memory:
>>>
>>>     $rs = $db->query($select); # query the db
>>>     foreach ($rs as $row) { # fetch the row
>>>         whatever($row);
>>>     }
>> ah yes - good catch, I do like iterators for keeping code nice and tight.
> 
> I don't what you guys did in PHP4, but I do the following:
> 
> <?php
> 
> if( $db->query( $query ) )
> {
>     while( ($row = $db->fetchRow()) )
>     {
>         whatever( $row );
>     }
> }
> 
> ?>
> 
> I fail to see the need for an iterator. But, I'll grant you, proper
> destructor support is nice.

I agree that there is no *need* for iterator (as your example demonstrates);
yet I do like the functionality - basing things on the 'need' argument alone and
taking it right down to the fundamentals ... why do we need php? why do we need internet?
or even computers? in truth we *need* none of these things (I can't eat it, sleep under it or
breathe it) ;-P

I like iterators, and in that sense it's like having warmed seating in the car - not needed
but I like it! having a new programming style/paradigm/<fit-better-word-here> in php5
might be a reason for some to step over.

I write code because I enjoy it - if all there was was assembler I would probably
never have got it the game - to me the development experience is something I care about ...
there is a reason I don't play with Perl (namely reading Perl code generally makes me feel
sea-sick). that said experience is personal, some, apparently, avoid php for the same reason
I avoid Perl.

that said php avoidance is silly - resistance is futile, we will assimilate ;-)

> 
> Cheers,
> Rob.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux