In PHP, how do I check if a function exists?

后端 未结 6 1101
挽巷
挽巷 2020-11-30 11:00

How can I check if the function my_function already exists in PHP?

6条回答
  •  一向
    一向 (楼主)
    2020-11-30 11:32

    Using function_exists:

    if(function_exists('my_function')){
        // my_function is defined
    }
    

提交回复
热议问题