How to determine if a function is defined in php

How to determine if a function is defined in php? I would like to do something like:

if(! function_defined(money_format)) // function not defined on windows
{
      function money_format($str) { ... }
}

Is this possible in php?

+3
source share
2 answers

You can use a function function_existsto determine if a function has been defined.

+19
source

It should be noted that you need to use method_exists to find out if a particular method is defined.

+6
source

Source: https://habr.com/ru/post/1705108/


All Articles