Debugging Code

CodeIgniter 3.x
Create helper file inside application/helper

function debug($data) {
 echo "<pre>";
 print_r($data);
 echo "</pre>";
 exit;
}

Call it with $autoload[‘helper] in application/config/autoload.php

Use it with parameter debug($parameter)

Example:

 $data = array(
   "var1" => "variable #1", 
   "date" => date('Y-m-d H:i:s')
 );
 debug($data);

so you will get the view like this

Debugging in Codeigniter - Silumansupra.com