What to do with depreciated functions

If PHP returns messages saying that functions have depreciated, this is a warning to indicate that the code that you are running has functions in your installed version of PHP that will be removed at some time in the future by a later version of PHP.

This may occur if one day your web host suddenly decides to upgrade their servers to a new version of PHP.  You should make sure that you are on the mailing lists for your hosting company so that you will be notified of changes that may cause issues.

Depreciated functions still exist and you get warnings. So they work as expected.  However in a future version of PHP, they might disappear.  It’s a way to signal changes to users which have code based on an older PHP version.

Normally the deprecated features get removed after some time, but it’s not predictable how long this takes.

So if you see these warnings, update the code. Most often the PHP documentation has more information why something has been deprecated and what to do. Most often it’s an improvement.

Changing to a new version of PHP will mean that you will have access to the latest features of the language, however, it may mean that older versions of an application will either fail or display warning messages.

You have to decide if you want your application to operate over different PHP platforms – if you do then you have to code with common functions that are in all versions of PHP.

Leave a Reply