• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
var_dump question

#1
Hello,
how and where I build the var_dump, which after a click on a button shows the content of an input on the selected viewers.
so, do I have to install that in the model or the controller?
Reply

#2
(10-03-2017, 02:09 PM)Germanikus Wrote: Hello,
how and where I build the var_dump, which after a click on a button shows the content of an input on the selected viewers.
so, do I have to install that in the model or the controller?

I think Preferably in controller immediately after the data statement 

Code:
var_dump($data);
Reply

#3
var_dump is a php method for viewing objects and arrays etc;

var_dump() - Dumps information about a variable.


SEE: PHP.NET = var_dump()

Here is an CodeIgniter Helper method to do formatted output:


PHP Code:
/**
 * varDebug () - Add this method to a CodeIgniter Helper.
 * -----------------------------------------------------------------------
 *
 * Formatted output of var_dump() etc;
 */
if ( ! function_exists('varDebug'))
{
    
/**
     * Debug Helper
     * -------------------------------------------------------------------
     * Outputs the given variable(s) with color formatting and location
     *
     * @param    mixed    - variables to be output
     */
    
function varDebug()
    {
        list(
$callee) = debug_backtrace();

        
$arguments func_get_args();

        
$total_arguments func_num_args();

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

        
$i 0;
        foreach (
$arguments as $argument)
        {
            echo 
'<strong>Debug #'.++$i.' of '.$total_arguments.'</strong>: '.'<br>';
            
var_dump($argument);
        }

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

Hope that helps
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.