We can check built in function or user defined functions before using them. The built in function function_exists checks this and returns true of false. It takes one string input and returns Boolean output. Here is an example.
echo " Yes this function is available to use ";
echo " Sorry , this is not available to use " ;
In the above code we have used is_int() which is a built in function in PHP, so we will get the output as this.
Yes this function is available to use

User defined functions

function my_function($var1,$var2,$var3){
return $var;
echo my_function(5,6,8); // Output 19 

echo " <br>Yes <i>my_function</i> is available to use ";
echo " <br>Sorry , <i>my_function</i> is not available to use " ;
Yes my_function is available to use

Example of uses

To check mysqli support, function_exists() is used.
if (function_exists('mysqli_connect')) {
  echo "mysqli is installed";
echo " Enable Mysqli support in your PHP installation "; 
Declaring variables Functions
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer