What exactly is the difference between the is_callable and function_exists in PHP?

后端 未结 5 1755
长发绾君心
长发绾君心 2021-02-01 01:22

I am working on a project, in which I am using a deprecated function from the older version. But don\'t want my script to stop if used in the older version.

So I am check

5条回答
  •  误落风尘
    2021-02-01 02:01

    When used in class context, is_callable returns true for class methods that are accessible ie public methods but method_exists returns true for all methods - public, protected and private. function_exists does same thing as method_exists outside class contexts.

提交回复
热议问题