Re: [PHP] PHP: array with null shows different with print_r and var_dump
On Wed, 2008-04-02 at 12:19 +0530, Sanjay Mantoor wrote: > 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? NULL and null are the same thing. If I'm correct var_dump() was created to solve the problem of not knowing what the datatypes are when using print_r(). Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP: array with null shows different with print_r and var_dump
On Tue, Apr 1, 2008 at 11:49 PM, Sanjay Mantoor <[EMAIL PROTECTED]> wrote: > 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] => > ) > print_r converts null, which is a variable type, like integer, string, float, etc, into an empty string. > where as var_dump($array) prints values like below > array(2) { > [0]=> > NULL// Does this convert to null to NULL? null is case-insensitive, so it doesn't matter how you type it. > [1]=> > NULL > } var_dump converts null into the string "NULL". > > Can you tell me why the above difference? > -- -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP: array with null shows different with print_r and var_dump
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