Question: I have an array:

```
$a = array('foo' => 'fooMe');

```

and I do:

```
print_r($a);

```

which prints:

```
Array ( [foo] => printme )

```

Is there a function, so when doing:

```
needed_function('    Array ( [foo] => printme )');

```

I will get the array `array('foo' => 'fooMe');` back?

Answer: 
If you want to store an array as string, use [`serialize` *[docs]*](http://php.net/manual/en/function.serialize.php) and [`unserialize` *[docs]*](http://php.net/manual/en/function.unserialize.php).

To answer your question: No, there is no built-in function to parse the output of `print_r` into an array again.
`json_encode()` and `json_decode()` function will do it.

```
$asso_arr = Array([779] => 79 => [780] => 80 [782] => 82 [783] => 83);
$to_string = json_encode($asso_arr);

```

It will be as a json format `{"779":"79","780":"80","782":"82","783":"83"}`

Then we will convert it into `json_decode()` then it gives associative array same as original:

```
print_r(json_decode($to_string));

```

Output will be `Array([779] => 79 => [780] => 80 [782] => 82 [783] => 83)` in associative array format.