Created
August 30, 2010 12:50
-
-
Save tbleckert/557357 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function print_r(arr) { | |
if( arr.constructor == Array || arr.constructor == Object ) { | |
document.write('<ul>'); | |
for( var p in arr ) { | |
if( arr[p].constructor == Array || arr[p].constructor == Object ) { | |
document.write('<li>['+p+'] => '+typeof(arr)+'</li>'); | |
document.write('<ul>'); | |
print_r(arr[p]); | |
document.write('</ul>'); | |
} else { | |
document.write('<li>['+p+'] => '+String(arr[p]).replace(/<\/?[^>]+>/gi, '')+'</li>'); | |
} | |
} | |
document.write('</ul>'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment