views:

188

answers:

1

I find myself frequently outputting PHP Array data into AS3 applications and I'm always having to do it the hard way - comma delimated, base-64 converted data with custom packers/unpackers on either end.

I'd really like an AS3 function that takes the default output of PHP's print_r and converts it to a (potentially nested) AS3 array. Is there any easy way to do this?

Sample Print_r output:

Array
(
    [0] => Array
        (
            [0] => 6
            [1] => Test #1 of the video creation system
            [2] => Short summary of test #1
        )

    [1] => Array
        (
            [0] => 7
            [1] => Tone
            [2] => Bar and Tone to warp the mind
        )

)
+2  A: 

Do you need print_r specifically, or just the contents of the PHP array?

If it's the contents you're after, you could json_encode() the php array, pass that to AS3 and decode it there using the JSON Library for AS3 (part of as3corelib).

If you are after the contents of print_r specifically, could you please explain why?

Lior Cohen