15 October 2024

To mark a PHP function as deprecated and provide an alternative in the docstring, use the @deprecated tag. This makes it clear to developers that the function is deprecated and specifies the alternative.

Source code viewer
  1. /**
  2.  * @deprecated since 1.2.0 Use newFunction() instead.
  3.  */
  4. function oldFunction() {
  5. // Deprecated function logic
  6. }
  7.  
  8. function newFunction() {
  9. // New function logic
  10. }
  11.  
Programming Language: PHP