Skip to content

Instantly share code, notes, and snippets.

@mcabreradev
Last active August 29, 2015 14:25
Show Gist options
  • Save mcabreradev/70a62f108dbbe38cf134 to your computer and use it in GitHub Desktop.
Save mcabreradev/70a62f108dbbe38cf134 to your computer and use it in GitHub Desktop.
<?php
// -------------------------------------------------------------------------
/**
* Debuguear información sobre una variable o mas en una forma que es legible por humanos.
*
* Ejemplo:
*
* Con una sola variable
* $this->pr($response);
*
* Con N variables
* $this->pr($request, $response, $log);
*
* @param mixed
* @return void
*/
public function pr ()
{
$numargs = func_num_args();
$arg_list = func_get_args();
$caller = array_shift(debug_backtrace());
echo '<pre><p>DEBUG file: ' . $caller['file'] . ' line:' . $caller['line'] . '</p>';
for ($i = 0; $i < $numargs; $i ++)
{
print_r($arg_list[$i]);
}
echo '</pre>';
}
function dd()
{
array_map(function($x) { var_dump($x); }, func_get_args()); die;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment