Skip to content

Instantly share code, notes, and snippets.

@jorgepedret
Created July 4, 2011 20:12
Show Gist options
  • Select an option

  • Save jorgepedret/1063870 to your computer and use it in GitHub Desktop.

Select an option

Save jorgepedret/1063870 to your computer and use it in GitHub Desktop.
PHP nice debug
<?php
if (!function_exists('pp')) {
function pp($obj) {
$data = json_encode(print_r($obj,true));
?>
<script type="text/javascript">
var obj = <?php echo $data; ?>;
var logger = document.getElementById('bsdLogger');
if (!logger) {
logger = document.createElement('div');
logger.id = 'bsdLogger';
document.body.appendChild(logger);
}
////console.log(obj);
var pre = document.createElement('pre');
pre.innerHTML = obj;
logger.appendChild(pre);
</script>
<?php
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment