> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Determining if a PHP function is available

> Discover how to check if a function is available in PHP using function_exists(), complete with code examples.

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, follow these steps:

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:

```javascript theme={null}
<?php
    $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 [http://example.com/function.php](http://example.com/function.php), where *example.com* 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 [http://us3.php.net/manual/en/function.function-exists.php](http://us3.php.net/manual/en/function.function-exists.php).

## Related articles

* [PHP script basics](/docs/php-script-basics)

* [Viewing PHP settings](/docs/view-php-settings)

* [Custom php.ini files](/docs/custom-php-ini-files)
