Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

$php_errormsg has been removed

$php_errormsg used to hold the message of the last error that PHP emitted. This is a feature handled by the error_get_last() function.

$php_errormsg was only set if the tracks_error directive was activated (by default, it was not).

PHP code

<?php

ini_set('track_errors', 1);

echo $a;

echo $php_errormsg;

?>

Before

PHP Notice:  Undefined variable: a 

Notice: Undefined variable: a 
Undefined variable: a

After

PHP Warning:  Undefined variable $a 

Warning: Undefined variable $a 
PHP Warning:  Undefined variable $php_errormsg 

Warning: Undefined variable $php_errormsg 

PHP version change

This behavior was deprecated in 7.2.

This behavior changed in 8.0.

See Also

Error Messages

Extension

© 2023-2026, Damien Seguy - Exakat