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? Quote 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? Quote 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] Quote 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? Quote 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 Quote 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']; Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.