This function allows you to print the contents of any variable, including a constructed object and an array.
<?php
$variable=”Hello World”;
print_r($variable);
$array=array(‘a’, ‘c’, ‘d’, ‘b’);
print_r($array);
?>
Returns
Hello World
Array ( [0] => a [1] => c [2] => d [3] => b )
You can also utilize this to print out all of the variables that are defined (with global scope) at any point in the script. Using the statement:
<?php
print_r($GLOBALS);
?>



