This article mainly introduces the use of var_export in PHP. It has certain reference value. Now I share it with you. Friends in need can refer to it.
var_export can convert an array into a string
Unlike var_dump, var_export does not output the type of data and character size, etc., but simply splices the key and value of the array into A string
<?php $arr = [ 'key1'=>'val1', 'key2'=>'val2', 'key3'=>'val3', 'key4'=>'val4', 'key5'=>'val5' ]; $str = var_export($arr,true); echo $str;//结果 array ( 'key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3', 'key4' => 'val4', 'key5' => 'val5', ) ?>
Recommended related articles:
1. Analysis of the difference between var_export and var_dump in php
Related video recommendations:
2.Dugu Jiujian (4)_PHP Video tutorial
The above is the entire content of this article. I hope it will be helpful to everyone’s learning. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
How to get the file extension through PHP
The above is the detailed content of How to use var_export in PHP. For more information, please follow other related articles on the PHP Chinese website!