php中var_export与var_dump的区别分析

var_dump -- 打印变量的相关信息 

var_export -- 输出或返回一个变量的字符串表示 

$data = array ('name' => 'abc', 'job' => 'programmer','a'=>array('aa','cc','bb')); 
$data = var_dump($data,TRUE); 
echo $data; 

//var_dump
array(3) { 
["name"]=> 
string(3) "abc" 
["job"]=> 
string(10) "programmer" 
["a"]=> 
array(3) { 
[0]=> 
string(2) "aa" 
[1]=> 
string(2) "cc" 
[2]=> 
string(2) "bb" 
} 
} 
bool(true) 

//var_export
array ( 
'name' => 'abc', 
'job' => 'programmer', 
'a' => 
array ( 
0 => 'aa', 
1 => 'cc', 
2 => 'bb', 
), 
) 

评论 抢沙发

表情