cowboysdude Posted January 27, 2015 Share Posted January 27, 2015 I'm trying to get an element out of an xml file but it keeps returning just 0 and I'm not sure why... <g eid="2015010301" gsis="56492" d="Sat" t="8:15" q="F"/> I'm trying to read the ['g eid'] and print it. So I'm using this: $gdate = (int)$xml->gms['g eid']; $arr1 = str_split($gdate); print_r($gdate); I'm using that to see what prints out so I can use it how I need to use it... when I do it returns this: Array ( [0] => 0 ) I'm trying to get it to return the g eid element. What am I doing wrong here? Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/294252-xml-element/ Share on other sites More sharing options...
requinix Posted January 27, 2015 Share Posted January 27, 2015 $xml->gms['g eid'];That says "give me the 'g eid' attribute of the gms element". What you want is "give me the 'eid' attribute of the g element of the gms element" (I think that's where it is). Quote Link to comment https://forums.phpfreaks.com/topic/294252-xml-element/#findComment-1504315 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.