|
Posted by Michael Fesser on 12/01/06 14:39
..oO(Tony Marston)
>> Just an example: Without
>> these interfaces it wouldn't be possible to use 'foreach' to iterate
>> over any arbitrary object:
>>
>> foreach ($directory as $file) {...}
>> foreach ($resultSet as $record) {...}
>
>With PHP 5 it is possible to use 'foreach' on an object without the use of
>interfaces, so your argument is not valid.
It's a huge difference whether you just loop through all of the object's
properties like an array (that's what you described above) or if each
iteration automatically calls a particular method, which for example
fetches the next record from a database.
The latter is the basis of the SPL extension and not possible without
interfaces. Maybe IYHO the entire extension is not valid as well?
Micha
Navigation:
[Reply to this message]
|