如果我有这个数组:
<?php
$myarray = Array
(
'keyword' => 'seo',
'title_factor' => false,
'description_factor' => false,
'headtags_factor' => false,
'imgalt_factor' => false,
'keyword_density' => 0,
);
var_dump($myarray);
print_r($myarray);
?>
这是var_dump和print_r的输出:
array(6) {
["keyword"]=>
string(3) "seo"
["title_factor"]=>
bool(false)
["description_factor"]=>
bool(false)
["headtags_factor"]=>
bool(false)
["imgalt_factor"]=>
bool(false)
["keyword_density"]=>
int(0)
}
Array
(
[keyword] => 'seo'
[title_factor] =>
[description_factor] =>
[headtags_factor] =>
[imgalt_factor] =>
[keyword_density] => 0
)
这是我想要的输出:
"Array
(
'keyword' => 'seo',
'title_factor' => false,
'description_factor' => false,
'headtags_factor' => false,
'imgalt_factor' => false,
'keyword_density' => 0,
);"
答案 0 :(得分:39)
$string = var_export($array, true);
答案 1 :(得分:5)
如果我正确,你正在搜索var_export