Return to Snippet

Revision: 45268
at April 28, 2011 01:25 by tasmanweb


Initial Code
/*
A print_r replacement function that can  handle nested arrays and strings
Usage: printr($array); 
*/
function printr($array){
	echo '<blockquote>';
	if (!is_array($array)) return;
	foreach($array as $key => $value){
		echo htmlspecialchars("$key: ");
		if (is_array($value)){ printr($value);}else{echo htmlspecialchars($value).'<br />';}
	}
	echo '</blockquote>';
}

Initial URL

                                

Initial Description
A print_r replacement function that can  handle nested arrays and strings.
Usage: printr($array);

Initial Title
printr: print_r replacement that can  handle nested arrays and strings

Initial Tags
php, function

Initial Language
PHP