[Fix PHP 7.2 / PHP 7.3] PHP Warning: Use of undefined constant (this will throw an Error in a future version of PHP)

PHP 7.2 si PHP 7.3 they brought more stability, flexibility and many new features, which the old scriptures, PluginATVs and WordPress theme do not digest them completely.

When you decide to upgrade the server from PHP 5.x to PHP 7.2 or PHP 7.3, you must also consider some code compatibility elements. It is very possible to meet otherwise with errors such as:

PHP message: PHP Warning: Use of undefined constant CONSTANT - assumed 'CONSTANT' (this will throw an Error in a future version of PHP)

This error message appears every time PHP code if you found an indefinite constant. Valid in all versions of PHP 7.2 si PHP 7.3.

For example, if we have:

echo $_POST[email]; // the "mail" constant will have to be defined, and the code will look like this:

echo $_POST["email"]; // - after saving, the PHP error "PHP Warning: Use of undefined constant (this will throw an Error in a future version of PHP)" will disappear.

This error can also occur if you forget to put the symbol "$"In front of the name of a variable.

[Fix PHP 7.2 / PHP 7.3] PHP Warning: Use of undefined constant (this will throw an Error in a future version of PHP)

About the author

Stealth

Passionate about everything that means gadget and IT, I am pleased to write on stealthsettings.com from 2006 and I love to discover new things about computers and macOS, Linux operating systems, Windows, iOS and Android.

Leave a Comment