rondog Posted January 29, 2010 Share Posted January 29, 2010 I have an array in AS3 that I am sending to AMFPHP var myArray:Array = [ {type:"text", title:"title 1"}, {type:"video", title:"title 2"}, {type:"text", title:"title 3"}, {type:"video", title:"title 4"} ]; In my PHP function I need to loop through the array and get to the objects for ($i = 0; $i < count($myArray); $i++) { $type = $myArray[$i]['type']; $title = $myArray[$i]['title']; } The above doesnt appear to be working. I also tried $type = $myArray[$i]->type; $title = $myArray[$i]->title ; AMFPHP is returning this error: Cannot use string offset as an array Anyone know whats up? Link to comment https://forums.phpfreaks.com/topic/190275-access-array-object-with-amfphp/ Share on other sites More sharing options...
Mchl Posted January 29, 2010 Share Posted January 29, 2010 var myArray:Array is not proper syntax sorry.... that's no PHP is it? Link to comment https://forums.phpfreaks.com/topic/190275-access-array-object-with-amfphp/#findComment-1003860 Share on other sites More sharing options...
rondog Posted January 29, 2010 Author Share Posted January 29, 2010 haha no its actionscript 3 if I do $title = $myArray[$i] it returns [object Object] Link to comment https://forums.phpfreaks.com/topic/190275-access-array-object-with-amfphp/#findComment-1003862 Share on other sites More sharing options...
Mchl Posted January 29, 2010 Share Posted January 29, 2010 What does vardump($myArray); say? Link to comment https://forums.phpfreaks.com/topic/190275-access-array-object-with-amfphp/#findComment-1003865 Share on other sites More sharing options...
rondog Posted January 29, 2010 Author Share Posted January 29, 2010 amfphp isnt liking the var_dump..if I return var_dump($myArray); I am getting a netStatus.BadVersion error...not sure if you know anything about AS3 print_r does the same thing crap this harder than I thought, lol Link to comment https://forums.phpfreaks.com/topic/190275-access-array-object-with-amfphp/#findComment-1003870 Share on other sites More sharing options...
rondog Posted January 29, 2010 Author Share Posted January 29, 2010 ah wow...figured it out solution: $myArray[$i][type]; NOT: $myArray[$i]['type']; Link to comment https://forums.phpfreaks.com/topic/190275-access-array-object-with-amfphp/#findComment-1003877 Share on other sites More sharing options...
Mchl Posted January 29, 2010 Share Posted January 29, 2010 *Mchl scratches his head I've no idea what's going on here Link to comment https://forums.phpfreaks.com/topic/190275-access-array-object-with-amfphp/#findComment-1003883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.