tags:

views:

350

answers:

2

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

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

Is this possible in php?

+16  A: 

You can use the function_exists function to determine if a function has been defined.

TenebrousX
+5  A: 

It's worth mentioning that you need to use method_exists to see if an object has a particular method defined.

Mark Biek