Created
September 15, 2013 08:31
-
-
Save asika32764/6568905 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
/** | |
* Print Array or Object as tree node. If send multiple params in this method, will batch print it. | |
* | |
* @param mixed $data Array or Object to print. | |
*/ | |
function show($data) | |
{ | |
$args = func_get_args(); | |
// Print Multiple values | |
if(count($args) > 1) { | |
$prints = array(); | |
$i = 1 ; | |
foreach( $args as $arg ): | |
$prints[] = "[Value " . $i . "]\n" . print_r($arg, 1); | |
$i++ ; | |
endforeach; | |
echo '<pre>'.implode("\n\n", $prints).'</pre>' ; | |
}else{ | |
// Print one value. | |
echo '<pre>'.print_r($data, 1).'</pre>' ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment