PHP: array with null shows different with print_r and var_dump
| From: | Sanjay Mantoor | Date: | Wed, 02 Apr 2008 06:49:20 +0000 |
| Subject: | PHP: array with null shows different with print_r and var_dump | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-272429@lists.php.net to get a copy of this message | ||
Hello,
I am new to PHP and PHP community.
Following program outputs different values with print_r and var_dump.
$array = array(null, NULL);
print_r($array); prints values like below
Array
(
[0] =>
[1] =>
)
where as var_dump($array) prints values like below
array(2) {
[0]=>
NULL // Does this convert to null to NULL?
[1]=>
NULL
}
Can you tell me why the above difference?
--
Thanks,
Sanjay Mantoor