Skip to content

Instantly share code, notes, and snippets.

@mattheu
Last active August 29, 2015 14:07
Show Gist options
  • Save mattheu/01e95497345bd5a475f4 to your computer and use it in GitHub Desktop.
Save mattheu/01e95497345bd5a475f4 to your computer and use it in GitHub Desktop.
Improved HM debug
<?php
function hm( $args ) {
$args = func_get_args();
?>
<style>
.hm_debug { word-wrap: break-word; white-space: pre; text-align: left; position: relative; background-color: rgba(0, 0, 0, 0.8); font-size: 11px; color: #a1a1a1; margin: 10px; padding: 10px; margin: 0 auto; width: 80%; overflow: auto; -moz-border-radius: 5px; -webkit-border-radius: 5px; text-shadow: none; }
</style>
<br />
<?php
echo '<pre class="hm_debug">';
foreach ( $args as $code ) :
// var_dump everything except arrays and objects
if ( ! is_array( $code ) && ! is_object( $code ) ) :
var_dump( $code );
else :
print_r( $code );
endif;
if ( $code != end( $args ) ) {
echo "\r";
}
endforeach;
echo '</pre><br />';
return reset( $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment