Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to check a function exist or not?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 140
    Comment on it

    To check a function exist or not in PHP we use a built-in function function_exists(). This function check that the function exists or not.

    Syntax:

    function_exists(function_name);
    

    It includes one parameter i.e., the name of the function which you want to check. It returns true if the function exists else returns false.

    For example:

    <?php
    function myrow()
    {
        return 1;
    }
    
    if (function_exists('myrow')) {
        echo "myrow function exist.<br />";
    } else {
        echo "myrow function does not exist.<br />";
    }
    ?>
    

    The output of the above code is:

    myrow function exist.
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: