sanchez77 Posted September 14, 2014 Share Posted September 14, 2014 So here is my array: array(1) { ["84EA0353-58EB-E311-A8B1-001D09E7525D"]=> array(1) { [0]=> object(stdClass)#7 (1) { ["data"]=> array(2) { ["amt"]=> string(7) "100.000" ["unit"]=> string(3) "BUC" } } }} I'm trying to set the variable $x to = amt. I've tried $x= $ArrayMap->amt; this but it comes up null. I've also tried: $x= $ArrayMap['amt']; But both come up NULL. Any ideas on what I'm doing wrong? Thanks, sanchez Link to comment https://forums.phpfreaks.com/topic/291062-array-variable-how-to-retreive/ Share on other sites More sharing options...
sanchez77 Posted September 14, 2014 Author Share Posted September 14, 2014 So, i think that it's array in an array and then an object, so to go to array then object i would use: $array[0]->x; but how you go to the same array's array? this didn't work either. $array[0]->array[1]->x; Link to comment https://forums.phpfreaks.com/topic/291062-array-variable-how-to-retreive/#findComment-1491096 Share on other sites More sharing options...
kicken Posted September 14, 2014 Share Posted September 14, 2014 Given the structure you showed above the path would be: $array["84EA0353-58EB-E311-A8B1-001D09E7525D"][0]->data['amt'] Link to comment https://forums.phpfreaks.com/topic/291062-array-variable-how-to-retreive/#findComment-1491097 Share on other sites More sharing options...
sanchez77 Posted September 14, 2014 Author Share Posted September 14, 2014 that was it. I took that id from another generated array and volia. Thanks kicken. Much appreciation. Link to comment https://forums.phpfreaks.com/topic/291062-array-variable-how-to-retreive/#findComment-1491099 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.