[英]How to tell if a function is defined in php
How do I determine if a function is defined in php?如何确定 function 是否在 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?这在 php 中是否可行?
You can use the function_exists
function to determine if a function has been defined.您可以使用function_exists
function 来确定是否已定义 function。
It's worth mentioning that you need to use method_exists to see if an object has a particular method defined.值得一提的是,您需要使用method_exists来查看 object 是否定义了特定的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.