AMT>> Are we discussing this feature's technical or aesthetic merits? Or
AMT>> both?

Technical.

AMT>> foreach ($dom->getElementsByTagname('person') as $person) {
AMT>>         list($firstname) = $person->getElementsByTagname('firstname');
AMT>>         $firstname_text_value = $firstname->firstChild->nodeValue;
AMT>> }
AMT>> 
AMT>> Compare that to:
AMT>> 
AMT>> foreach($s->person as $person) {
AMT>>     $firstname_text_value = $person->firstname;
AMT>> }
AMT>> 
AMT>> You tell me which one "nobody can understand."

Both can be understood, but in the first case you know wat is going on (so 
you can rely on $s->person being array and you would be able to do:
$elements = $dom->getElementsByTagname('person');
do_something_with($elements[0]);

and in the second case there's so much magic you don't know what the hell 
is really going on. That's OK when you need to do just that, that stops to 
be OK when you want to slightly modify the behaviour and discover the 
magic is tightly coupled with particular case of use. For example, what 
exactly is $person->firstname there? Tag, or some attribute, or contents? 
What is $s->person - is it list of all tags with name 'person' contained 
in $s or is it element with ID 'person' in $s or maybe it is 'person' 
attribute of tag $s? How can I see it from that code? I can't. 


-- 
Stanislav Malyshev, Zend Products Engineer   
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.109

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to