开发者

Output an array as PHP eval-able code

Basically I want some function like array_as_php which is essentially the inverse of eval:

$array = array( '1' => 'b', '2' => 'c' );
echo array_as_php($array);

will print the following eval-able 开发者_开发问答string:

array( '1' => 'b', '2' => 'c' )


var_export() is what you are looking for.

$array = array ('1' => 'b', '2' => 'c' );
echo var_export($array, true);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜