Skip to content

Instantly share code, notes, and snippets.

@asika32764
Created September 15, 2013 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asika32764/6568905 to your computer and use it in GitHub Desktop.
Save asika32764/6568905 to your computer and use it in GitHub Desktop.
/**
* 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