Use PHP var_export API to dump data to file

Some time we may not want export complex hash to console but file, we can do like this to dump to file by var_export
<? php

$a  =  array ( ' abc ' => " 123 " );

#  var dump
var_dump ( $a );

#  var_export
echo  var_export ( $a );

#  export to file
$b  =  var_export ( $a ,  true );
error_log ( $b . " \n " ,  3 ,  " /tmp/ymiao.log " );  

Result:
cat /tmp/ymiao.log
array (
  'abc' 
= > ' 123 ' ,
)

你可能感兴趣的:(Use PHP var_export API to dump data to file)