Evening Roawn,

There is no competition to see which single problem we are going to solve,
we can fix more than one thing, obviously :)

What we are discussing here is the value of this particular feature, not
the value of things that nobody has taken the time to propose, implement,
or fix.

This contributor has waited a year for this conversation to start, it would
be nice if we could stay focused.

If you would like to talk about the shortcomings in simplexml (or
anything), might I suggest you start a new topic and see if you can drum up
some support for changes/fixes :)

Cheers
Joe

On Sat, Jan 7, 2017 at 6:24 PM, Rowan Collins <rowan.coll...@gmail.com>
wrote:

> On 07/01/2017 17:01, Joe Watkins wrote:
>
>> Evening Rowan,
>>
>> I must protest: It is wasteful, unclear, and generally nasty, to create,
>> return, and manipulate an array if you are only ever going to reference one
>> element in code.
>>
>
> Meh, feels like a micro-optimisation to me, and "[0] to access first
> search result" seems pretty obvious, but fair enough if you disagree.
>
> I know development's not a zero-sum game, but there are plenty of things
> I'd add to the SimpleXML extension that aren't just aliases for things you
> can trivially do already.
>
> For instance, sticking with XPath usage, the fact that
> registerXPathNamespace() only affects the current element, so has to be
> re-run as you traverse:
>
> $sx->registerXPathNamespace('a', 'http://example.com');
> $foo = $xml->xpath('//a:foo')[0];
> // do something with $foo
> $foo->registerXPathNamespace('a', 'http://example.com'); // won't work
> without this
> $bar = $foo->xpath('./a:bar')[0];
>
> That's a lot more intrusive than needing to add "[0]" next to a few method
> calls.
>
>
> Regards,
> --
> Rowan Collins
> [IMSoP]
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to