Created
July 2, 2013 09:27
-
-
Save furu/5907931 to your computer and use it in GitHub Desktop.
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 | |
/* | |
* 目的: print_r や var_dump をブラウザで見た場合にきれいに整形して表示する | |
*/ | |
function pp($expression, $method = 'var_dump') { | |
echo '<pre>'; | |
switch ($method) { | |
case 'print_r': | |
print_r($expression); | |
break; | |
case 'var_dump': | |
var_dump($expression); | |
break; | |
default: | |
throw new Exception('Invalid method'); | |
break; | |
} | |
echo '</pre>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment