tags:

views:

29

answers:

3

I'm not even entirely sure how to ask the question, but assuming I have an array in memory like this:

Array (
    [0] => Array
        (
            [0] => Array
                (
                    [0] => 18451
                    [1] => MDX
                )
            [1] => Array
                (
                    [0] => 18450
                    [1] => NSC
                )
            [2] => Array
                (
                    [0] => 18446
                    [1] => RL
                )
          )
)

Is there some existing functionality to turn it into the code version of that array? I have a # of arrays I need to do this for, nested to various degrees. So I imagine I want output something like

$arrayname[] = array(array('18451','MDX'),array('18450','NSC'),array('18446','RL'));

I can write something to do it, but I'd rather not recreate the wheel if there's an existing way to do it.

+3  A: 

This may be all you need:

http://us.php.net/var_export

konforce
My hero ! Thanks much
Stomped
A: 

manually loop through the array recursively and create a string like how you want.

coder
A: 

var_export could help you there i think. The other option would be looping through it manually :(

Sarfraz