Welcome Guest, Not a member yet? Register   Sign In
Something like laravel "dd" function
#6

Or the old CI Favorite as a helper method:

PHP Code:
/**
 * ------------------------------------------------------------------------
 *
 * dDebug Helper
 *
 * Outputs the given variable(s) with formatting and location
 *
 * @access    public
 * @param    mixed    - variables to be output
 */
if ( ! function_exists('dDebug'))
{
    function 
dDebug()
    {
        list(
$callee) = debug_backtrace();

        
$args func_get_args();

        
$total_args func_num_args();

        echo 
'<div><fieldset style="background: #fefefe !important; border:1px red solid; padding:15px">';
        echo 
'<legend style="background:blue; color:white; padding:5px;">'.$callee['file'].' @line: '.$callee['line'].'</legend><pre><code>';

        
$i 0;

        foreach (
$args as $arg)
        {
            echo 
'<strong>Debug #' . ++$i ' of ' $total_args '</strong>: ' '<br>';

            
var_dump($arg);
        }

        echo 
"</code></pre></fieldset><div><br>";
    }

What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Something like laravel &quot;dd&quot; function - by InsiteFX - 12-10-2016, 03:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB