I\'ve seen alot of coders implement SimpleXML_load_string()
instead of the SimpleXMLElement()
class. Are there any benefits to using the former over th
It's mostly a convenience wrapper. With constructing the base element yourself, you need at least two lines of code to accomplish anything. With simplexml_load_string() a single expression might suffice:
print simplexml_load_string($xml)->title;
Is shorter than:
$e = new SimpleXMLElement($xml);
print $e->title;
And then of course, there is also the slight variation in the function signature.
Update: And exactly the same length as of
print(new SimpleXMLElement($xml))->title;