下面的示例看看这三个函数的具体的区别,其中var_dump和var_export比较少用,但他们两者又很相似。所以可以看看:
<?php<BR>$a = array(1,1,32,322,3433,array(32,232,23232));<BR>$b = 1234;<BR>$c = "alsdfl;asdf";<BR>$d = 'a';<BR>$e = fopen("slsl.txt", "r");<BR>var_dump($a);<BR>echo "<br>";<BR>var_dump($b);<BR>echo "<br>";<BR>var_dump($c);<BR>echo "<br>";<BR>var_dump($d);<BR>echo "<br>";<BR>var_dump($e);<BR>echo "<br>";<BR>echo "<br>";<BR>echo "<br>";<BR>echo "<br>";<BR>var_export($a);<BR>echo "<br>";<BR>var_export($b);<BR>echo "<br>";<BR>var_export($c);<BR>echo "<br>";<BR>var_export($d);<BR>echo "<br>";<BR>var_export($e);<BR>echo "<br>";<BR>echo "<br>";<BR>echo "<br>";<BR>echo "<br>";<BR>print_r($a);<BR>echo "<br>";<BR>print_r($b);<BR>echo "<br>";<BR>print_r($c<em style="color:transparent">本@文来源[email protected]搞@^&代*@码网(</em><q>搞代gaodaima码</q>);<BR>echo "<br>";<BR>print_r($d);<BR>echo "<br>";<BR>print_r($e);<BR>echo "<br>";<BR>
输出:
Warning: fopen(slsl.txt) [function.fopen]: failed to open stream: No such file or directory in E:\mywww\yangtest\base1.php on line 6<BR>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) } }<BR>int(1234)<BR>string(11) "alsdfl;asdf"<BR>string(1) "a"<BR>bool(false)<BR>array ( 0 => 1, 1 => 1, 2 => 32, 3 => 322, 4 => 3433, 5 => array ( 0 => 32, 1 => 232, 2 => 23232, ), )<BR>1234<BR>'alsdfl;asdf'<BR>'a'<BR>false<BR>Array ( [0] => 1 [1] => 1 [2] => 32 [3] => 322 [4] => 3433 [5] => Array ( [0] => 32 [1] => 232 [2] => 23232 ) )<BR>1234<BR>alsdfl;asdf<BR>a<BR>
现在可以看到效果了,注意,最后一个不是我没有粘贴过来,而是他本来就没有显示什么东西。