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 Link to comment https://forums.phpfreaks.com/topic/175156-solved-arrays/ 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 Link to comment https://forums.phpfreaks.com/topic/175156-solved-arrays/#findComment-923138 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 ) Link to comment https://forums.phpfreaks.com/topic/175156-solved-arrays/#findComment-923143 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 Link to comment https://forums.phpfreaks.com/topic/175156-solved-arrays/#findComment-923146 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 Link to comment https://forums.phpfreaks.com/topic/175156-solved-arrays/#findComment-923150 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 Link to comment https://forums.phpfreaks.com/topic/175156-solved-arrays/#findComment-923157 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']; Link to comment https://forums.phpfreaks.com/topic/175156-solved-arrays/#findComment-923299 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. Link to comment https://forums.phpfreaks.com/topic/175156-solved-arrays/#findComment-923512 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 Link to comment https://forums.phpfreaks.com/topic/175156-solved-arrays/#findComment-923517 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.