Home » Php » Advance Php Interview Question » How to check function exists in php

How to check function exists in php

How to check function exists in php

function_exists(): If you are using function that is not the part of the core Php function. It is the part of extra library and extension like as Curl extension, IMAP extension and rewrite modules to use these type of function, we required to enable an extension from Php ini file. function_exists is a Php inbuilt function and return TRUE if the given function has been defined otherwise return FALSE. we can use function_exists for Inbuilt and user defined function to check the function existence.

function_exists takes a function name as a parameter, and returns true if that function is available for use.

syntax: bool function_exists ( string $function_name )

Example: To check the curl_init function is available or not for using. If curl is enables on server from php.ini file then function is exists otherwise not.

, , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">