note 32954 added to language.types
| From: | fabrice at vignals dot nospam dot com | Date: | Wed, 11 Jun 2003 20:36:45 +0000 |
| Subject: | note 32954 added to language.types | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-50202@lists.php.net to get a copy of this message | ||
Compare with print_r(); :
<?php
$a = array(1, 2,"1","2", array("a", "b", "c") );
var_export ($a);
print_r($a);
/* var_export ($a); output:
array (
0 => 1,
1 => 2,
2 => '1',
3 => '2',
4 =>
array (
0 => 'a',
1 => 'b',
2 => 'c',
),
)
*/
/* print_r($a); output :
Array
(
[0] => 1
[1] => 2
[2] => 1
[3] => 2
[4] => Array
(
[0] => a
[1] => b
[2] => c
)
)
*/
?>
With var_export you can easily(visibly) know if a number is a string or an integer. <=>
representation is valid PHP code.
With print_r, you can only manipulate its return as a string.
See also : http://www.php.net/manual/function.print-r.php
----
Manual Page -- http://www.php.net/manual/en/language.types.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32954
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32954&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32954&report=yes