(PHP4 )

print_r --  Prints human-readable information about a variable


void print_r (mixed expression)

This function displays information about the values of variables in a way that's readable by humans. If given a string, integer or double, the value itself will be printed. If given an array, values will be presented in a format that shows keys and elements. Similar notation is used for objects.

Compare print_r() to var_dump().

$a = array (1, 2, array ("a", "b", "c"));
print_r ($a);


This function will continue forever if given an array or object that contains a direct or indirect reference to itself or that contains an array or object on a deeper level that does so. This is especially true for print_r($GLOBALS), as $GLOBALS is itself a global variable and contains a reference to itself as such.