Write a PHP script to get the last occurred error

error_get_last():-

error_get_last() function returns an associative array describing the last error with keys "type", "message", "file" and "line". If the error has been caused by a PHP internal function then the "message" begins with its name. Returns NULL if there hasn't been an error yet.


code:-

<?php

echo $x;

  print_r(error_get_last());

?>

output:-

Array                                                       
(                                                           
    [type] => 8                                             
    [message] => Undefined variable: x                      
    [file] => /home/students/0d0149c0-f42e-11e6-a8c0-b738b9f
f32f9.php                                                   
    [line] => 2                                             
)

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post