How to determine if a PHP function is available

This article describes how to use the function_exists() function to determine whether or not a function is available for your PHP installation.

Determining if a PHP function is available

You can determine whether or not a PHP function is enabled for your web site by using the function_exists() function.

To determine if a function is available:

  1. Create a file that contains the following code. This sample code checks to see if the fsockopen() function is available. To check for another function, change the $function_name variable's value:
        $function_name = "fsockopen";
        if ( function_exists($function_name ) ) {
            echo "$function_name  is enabled";
        else {
            echo "$function_name  is not enabled";
  2. Save the file as function.php or something similar.
  3. Upload the file to your public_html directory.
  4. Use your browser to go to, where represents your web site's domain name. The page displays whether or not the function is enabled for your web site.

More Information

For more information about the function_exists() function, please visit

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

Usamos cookies con el fin de personalizar para usted nuestro sitio Web y analizar el uso de éste. Usted acepta esto haciendo clic en “Acepto” o al continuar usando el sitio Web. Hay más información sobre cookies en nuestra política de privacidad.