PHP - difference between print_r() and var_dump()

1:  <?php  
2:       $a = array('name'=>"Alice", 'age'=>35,'wife'=>'Blia');  
3:       print_r($a);  
4:       //print_r can not be displayed by print_r()  
5:       echo "print_r() result";  
6:       print_r(true); //print "1"  
7:       print_r(false); //print ""  
8:       print_r(null); //print ""  
9:       //For this reason,var_dump() is preferred  
10:       echo "var_dump() result";  
11:       var_dump(true); //print "boolean true"  
12:       var_dump(false); //print "boolean false"  
13:       var_dump(null); //print "null"  
14:  ?>  

No comments:

Post a Comment