解析php中var_dump,var_export,print_r三个函数的区别_PHP教程
程序员文章站
2022-04-09 09:51:27
...
下面的示例看看这三个函数的具体的区别,其中var_dump和var_export比较少用,但他们两者又很相似。所以可以看看:
$a = array(1,1,32,322,3433,array(32,232,23232));
$b = 1234;
$c = "alsdfl;asdf";
$d = 'a';
$e = fopen("slsl.txt", "r");
var_dump($a);
echo "
";
var_dump($b);
echo "
";
var_dump($c);
echo "
";
var_dump($d);
echo "
";
var_dump($e);
echo "
";
echo "
";
echo "
";
echo "
";
var_export($a);
echo "
";
var_export($b);
echo "
";
var_export($c);
echo "
";
var_export($d);
echo "
";
var_export($e);
echo "
";
echo "
";
echo "
";
echo "
";
print_r($a);
echo "
";
print_r($b);
echo "
";
print_r($c);
echo "
";
print_r($d);
echo "
";
print_r($e);
echo "
";
输出:
Warning: fopen(slsl.txt) [function.fopen]: failed to open stream: No such file or directory in E:\mywww\yangtest\base1.php on line 6
array(6) { [0]=> int(1) [1]=> int(1) [2]=> int(32) [3]=> int(322) [4]=> int(3433) [5]=> array(3) { [0]=> int(32) [1]=> int(232) [2]=> int(23232) } }
int(1234)
string(11) "alsdfl;asdf"
string(1) "a"
bool(false)
array ( 0 => 1, 1 => 1, 2 => 32, 3 => 322, 4 => 3433, 5 => array ( 0 => 32, 1 => 232, 2 => 23232, ), )
1234
'alsdfl;asdf'
'a'
false
Array ( [0] => 1 [1] => 1 [2] => 32 [3] => 322 [4] => 3433 [5] => Array ( [0] => 32 [1] => 232 [2] => 23232 ) )
1234
alsdfl;asdf
a
现在可以看到效果了,注意,最后一个不是我没有粘贴过来,而是他本来就没有显示什么东西。
复制代码 代码如下:
$a = array(1,1,32,322,3433,array(32,232,23232));
$b = 1234;
$c = "alsdfl;asdf";
$d = 'a';
$e = fopen("slsl.txt", "r");
var_dump($a);
echo "
";
var_dump($b);
echo "
";
var_dump($c);
echo "
";
var_dump($d);
echo "
";
var_dump($e);
echo "
";
echo "
";
echo "
";
echo "
";
var_export($a);
echo "
";
var_export($b);
echo "
";
var_export($c);
echo "
";
var_export($d);
echo "
";
var_export($e);
echo "
";
echo "
";
echo "
";
echo "
";
print_r($a);
echo "
";
print_r($b);
echo "
";
print_r($c);
echo "
";
print_r($d);
echo "
";
print_r($e);
echo "
";
输出:
复制代码 代码如下:
Warning: fopen(slsl.txt) [function.fopen]: failed to open stream: No such file or directory in E:\mywww\yangtest\base1.php on line 6
array(6) { [0]=> int(1) [1]=> int(1) [2]=> int(32) [3]=> int(322) [4]=> int(3433) [5]=> array(3) { [0]=> int(32) [1]=> int(232) [2]=> int(23232) } }
int(1234)
string(11) "alsdfl;asdf"
string(1) "a"
bool(false)
array ( 0 => 1, 1 => 1, 2 => 32, 3 => 322, 4 => 3433, 5 => array ( 0 => 32, 1 => 232, 2 => 23232, ), )
1234
'alsdfl;asdf'
'a'
false
Array ( [0] => 1 [1] => 1 [2] => 32 [3] => 322 [4] => 3433 [5] => Array ( [0] => 32 [1] => 232 [2] => 23232 ) )
1234
alsdfl;asdf
a
现在可以看到效果了,注意,最后一个不是我没有粘贴过来,而是他本来就没有显示什么东西。
上一篇: php Session存储到Redis的方法_PHP教程
下一篇: 给某XXX房地产网优化一例
推荐阅读
-
解析php中var_dump,var_export,print_r三个函数的区别
-
PHP 中 var_export、print_r、var_dump 调试中的区别
-
php中var_export与var_dump的区别分析
-
解析mysql中UNIX_TIMESTAMP()函数与php中time()函数的区别
-
解析php中var_dump,var_export,print_r三个函数的区别_php技巧
-
解析mysql中UNIX_TIMESTAMP()函数与php中time()函数的区别_PHP教程
-
解析PHP中ob_start()函数的用法_PHP教程
-
解析php addslashes()与add*es()函数的区别和比较_PHP教程
-
php中解析带中文字符的url函数分享_PHP教程
-
WordPress中调试缩略图的相关PHP函数使用解析,wordpress缩略图_PHP教程