I am using two ways to debug code
one is print the data and die the function in specific point.
print_r($data);die;
second one is writing log file in specific point in code.
function write_log($log_msg)
{
$log_filename = "logs";
if (!file_exists($log_filename))
{
mkdir($log_filename, 0777, true);
}
$log_file_data = $log_filename.'/debug.log';
file_put_contents($log_file_data, $log_msg . "
", FILE_APPEND);
}
write_log("Writing Log");
$a = array(
array('id' => '1','date' => '09-04-2018','length' => '10'),
array('id' => '2','date' => '09-04-2018','length' => '20'),
array('id' => '1','date' => '10-04-2018','length' => '11')
);
write_log(print_r($a,1));