Last active
November 3, 2015 19:15
-
-
Save CurtisL/14c37565f1f166eb74a9 to your computer and use it in GitHub Desktop.
formatted var dumps for quick debugging in wordpress
This file contains hidden or 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
| <?php | |
| /** | |
| * Dump and Die. | |
| * Dumps all args passed and kills the script. | |
| */ | |
| function dd() { | |
| $args = func_get_args(); | |
| array_map( function( $x ) { | |
| dump( $x ); | |
| }, func_get_args() ); | |
| wp_die( '', 'Manual Dump And Die' ); | |
| die; | |
| } | |
| /** | |
| * Dumps variable. | |
| * | |
| * @param mixed $var var to dump. | |
| */ | |
| function dump( $var ) { | |
| echo '<small><pre><code>'; | |
| var_dump( $var ); | |
| echo '</code></pre></small>'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment