Here's some info about the two functions.
Descriptions (from manual) :
--------------------------------
print_r -- Prints human-readable information about a variable
(PHP 4)
var_dump -- Dumps information about a variable
(PHP 3 >= 3.0.5, PHP 4)
An example :
--------------------------------
<pre>
<?php
$example = array ('str' => 'is good',
'letters' => array ('a','b','c'),
'integer' => 31,
'float/double' => 35.3787,
24 => 'hello');
echo 'print_r :'. "\n\n";
print_r ($example);
echo 'var_dump :'. "\n\n";
var_dump ($example);
?>
</pre>
Output (layout altered) :
---------------------------------
print_r :
Array
(
[str] => is good
[letters] => Array
(
[0] => a
[1] => b
[2] => c
)
[integer] => 31
[float/double] => 35.3787
[24] => hello
)
var_dump :
array(4)
{
["str"] => string(7) "is good"
["letters"] => array(3)
{
[0] => string(1) "a"
[1] => string(1) "b"
[2] => string(1) "c"
}
["integer"] => int(31)
["float/double"] => float(35.3787)
[24] => string(5) "hello"
}
Manual Entries :
--------------------------------
http://www.php.net/manual/en/function.print-r.php
http://www.php.net/manual/en/function.var-dump.php
Regards,
Philip
(test: print var dump faq8490)
On Tue, 10 Apr 2001, John Lim wrote:
> Just a question that has been besetting me for a while:
>
> which is better for debugging -- vardump( ) or print( ) ?
>
> Does anyone have a preference? Why? Is one better than the other?
> Thanks for answering this prickly question!
>
> John Lim
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Philip Olson
http://www.cornado.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]