Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deprecate a function in PHP?

Tags:

php

deprecated

At the team with which I work, we have an old codebase using PHP's ibase_* functions all over the code to communicate with database. We created a wrapper to it that would do something else beside just calling the original function and I did a mass search-replace in the entire code to make sure that wrapper is used instead.

Now, how do we prevent usage of ibase_* functions in the future?

Preferably, I'd like to still have them available, but make it throw a NOTICE or WARNING when it is used.

A solution in pure PHP (not needing to compile a custom version of PHP) is preferred.

like image 391
Milan Babuškov Avatar asked Oct 11 '08 14:10

Milan Babuškov


People also ask

Is PHP 7.3 deprecated?

Since these have been implicitly enforced since PHP 5.2. 1, PHP 7.3 deprecated their usage as they are redundant.


1 Answers

trigger_error()

function my_deprecated_function() {     trigger_error("Deprecated function called.", E_USER_NOTICE);     // do stuff. } 
like image 200
nickf Avatar answered Oct 14 '22 06:10

nickf