by
65 8

A print_r replacement function that can handle nested arrays and strings

Usage: printr($array);
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/9983/A-print_r-replacement-function-that-can-?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
/* 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>'; }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus