Show php error with ini_set()

Even experience php programmer can make mistake, since most of them are typo php error message then become valuable resource for debugging.

By default, error message will show depend on error made, but in specific environment where tweaking in php.ini  has been made by system administrator. Such free hosting will do it for good.

With assumption that php_ini not included in list of “disable_function” then php_ini will help 🙂

<?php
ini_set(‘error_reporting’, E_ALL);
ini_set(‘display_errors’, ‘On’);
ini_set(‘display_startup_errors’, ‘On’);

$first_name      = trim($_GET[‘first_name’]);
echo $first_name;
?>

If there is no parse errror, the above enables “Notice: Undefined” error on screen.

If the code for an error the “Parse error” as follows, the error isn’t defined as should be

echo $first_name);
) will be error source, running it then you’ll get this error message

Parse error: parse error, unexpected ‘)’, expecting ‘,’ or ‘;’ in a.php on line 7

now, what you get for this ?
eho $first_name; // should be echo

parse error or …..