This is sample code to catch error in PHP.
<?php
// Error handler function.
function customError($errno, $errstr)
{
echo "<b>Error:</b> [$errno] $errstr";
}
// Set error handler.
set_error_handler('customError');
// Trigger error.
echo($test);
?>
I am using frameworks. i dont know how to log errors. I tried by giving function customError($errno, $errstr) in modal and I called from controller it doesn't work for me. How to handle error in frameworks?