Can I convert an array into memory into a code representation of this array?

I'm not even quite sure how to ask a question, but suppose I have an array in memory:

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

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

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

I can write something to do this, but I would prefer not to recreate the wheel if there is an existing way to do this.

+3
source share
3 answers

This may be all you need:

http://us.php.net/var_export

+3
source

, .

0

var_export , . : (

0

Source: https://habr.com/ru/post/1735005/


All Articles