note 32954 deleted from language.types by nlopess
| From: | nlopess@php.net | Date: | Fri, 26 Dec 2003 09:52:36 +0000 |
| Subject: | note 32954 deleted from language.types by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62495@lists.php.net to get a copy of this message | ||
Note Submitter: fabrice@vignals.nospam.com
----
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