SchweppesAle Posted September 22, 2009 Share Posted September 22, 2009 I receive the following output through var_dump: array(59) { [0]=> array(16) { [0]=> object(SimpleXMLElement)#11 (2) { ["@attributes"]=> array(1) { ["id"]=> string(12) "subscriberid" } [0]=> string(32) "0306750863bcfb1ea1eb15065a9789f7" echo some_array[0][0]; returns the string "0306750863bcfb1ea1eb15065a9789f7" How would I instead reference the string "subscriberid"? Thanks Quote Link to comment Share on other sites More sharing options...
Garethp Posted September 22, 2009 Share Posted September 22, 2009 Try echo "<pre>"; echo print_r($some_array); echo "</pre>"; It'll be easier to read what information is in the array Quote Link to comment Share on other sites More sharing options...
SchweppesAle Posted September 22, 2009 Author Share Posted September 22, 2009 how's this? Array ( [0] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => subscriberid ) [0] => 0306750863bcfb1ea1eb15065a9789f7 ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => subscribedate ) [0] => 2009-08-27 ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => unsubscribedate ) [0] => 2009-08-27 ) Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted September 22, 2009 Share Posted September 22, 2009 $array[0][0]->id i think that would be it Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted September 22, 2009 Share Posted September 22, 2009 Try this: $some_array['@attributes']['id'] or a variation of that on your array. not an xml man myself Quote Link to comment Share on other sites More sharing options...
Garethp Posted September 22, 2009 Share Posted September 22, 2009 $sxe = $some_array[0]; echo $sxe->attributes()->id; Try that Quote Link to comment Share on other sites More sharing options...
Zane Posted September 23, 2009 Share Posted September 23, 2009 using the context/example you supplied it would be echo some_array[0]['@attributes']['id']; Quote Link to comment Share on other sites More sharing options...
SchweppesAle Posted September 23, 2009 Author Share Posted September 23, 2009 using the context/example you supplied it would be echo some_array[0]['@attributes']['id']; *plants head on desk* really thought that one would work. lol, nothing still though echo $stream_users[0]['@attributes']['id']; I've tried the other suggestions as well. Quote Link to comment Share on other sites More sharing options...
SchweppesAle Posted September 23, 2009 Author Share Posted September 23, 2009 $sxe = $some_array[0]; echo $sxe->attributes()->id; Try that $sxe = $stream_users[0][0]; echo $sxe->attributes()->id; wooooo, it worked. Thanks man Quote Link to comment 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.