|
Posted by Steve on 01/08/08 03:35
"Rik Wasmus" <luiheidsgoeroe@hotmail.com> wrote in message
news:op.t4k33gji5bnjuv@metallium.lan...
> On Tue, 08 Jan 2008 01:04:54 +0100, Steve <no.one@example.com> wrote:
>> "Rik Wasmus" <luiheidsgoeroe@hotmail.com> wrote in message
>> news:op.t4k2u0075bnjuv@metallium.lan...
>>> On Tue, 08 Jan 2008 00:31:57 +0100, Steve <no.one@example.com> wrote:
>>>> "devloop" <andrea2004@gmx.de> wrote in message
>>>> news:a21e6087-932a-4683-95d0-3d1d65d7288e@s19g2000prg.googlegroups.com...
>>>> Thank you soooo much! That΄s it! I would have cost me years to find
>>>> that as in JAVA you may write this or leave it!
>>>>
>>>> Do I have to add any include line to use iterator class or
>>>> collections? Do they exist in php?
>>>>
>>>> ===========
>>>>
>>>> no.
>>>
>>> Yes, Iterators exist, as the are an interface for a class.
>>
>> should have been more specific. 'no' was to the first question..
>
> Ah, your answer was confusing in that aspect indeed/
i'll try harder to be more clear next time. :)
>>>> there is very little strong typing in php
>>>
>>> Which has to do with?
>>
>> usually people customize a class to be enumerable is to get performance
>> benefits in storing a specific type rather than a variant, default
>> collection. that's what i meant. the second most common is functional
>> clarity for the caller.
>>
>>>> and an array has the
>>>> enumerable interface. anything you put in an array can be iterated with
>>>> foreach
>>>
>>> Yes, however, creating an object as an ArrayObject/implementing
>>> ArrayIterator, and private variables, will give you the possibility for
>>> type hinting:
>>
>> true...but, i don't have that ide if 'intellisense' is what you mean. :)
>
> Huh? ide? intellisense? I see no connection to an IDE, and intellisense
> you'll have to explain to me.
it's also called auto-completion...start typing a variable name in and you
have to option completing it by selecting from a list...or, you can see the
next param that's supposed to be entered if typing a function - complete
with the param data type. that was one kind of 'hinting' i was guessing at.
just wasn't sure that was what you meant. i know it wasn't now.
>> as for the code below, MyParticularObject can 'hint' a function param
>> type
>> anywhere...even a proc function. so, i'm not sure what you mean.
>
> That was a response to your 'typing' remark, guessing at what you meant,
> an illustration how you could force an array object to hold only one type
> of data/class in it's 'collection'/array
yes, that's what i meant. as it is though, i haven't really had a need to
implement an interator on a custom class in php. arrays work fine for just
about everything in php. i did, however, enjoy reading the article you
referenced about doing just that - custom classes implementing iterators.
[Back to original message]
|