|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-08-03 05:23 UTC] lists at cyberlot dot net
[2004-08-03 12:01 UTC] chregu@php.net
[2004-08-03 15:29 UTC] lists at cyberlot dot net
[2004-08-03 15:39 UTC] lists at cyberlot dot net
[2011-05-31 11:22 UTC] stu at dyndev dot co dot nz
[2015-03-22 02:07 UTC] perske at uni-muenster dot de
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 04:00:02 2025 UTC |
Description: ------------ When using simplexml to access a element the returned object it returns a object instead of a string Have to type cast it as a (string) to get the information back, Should not have to typecast. If a typecast is required it should be specificed in the docs. Reproduce code: --------------- $string = <<<XML <?xml version='1.0'?> <document> <cmd>login</cmd> <login>Richard</login> </document> XML; $xml = simplexml_load_string($string); print_r($xml); $login = $xml->login; print_r($login); $login = (string) $xml->login; print_r($login); Expected result: ---------------- SimpleXMLElement Object ( [cmd] => login [login] => Richard ) Richard Richard Actual result: -------------- SimpleXMLElement Object ( [cmd] => login [login] => Richard ) SimpleXMLElement Object ( [0] => Richard ) Richard