The get_extension_funcs Function
The get_extension_funcs
function returns an array with the names of all functions
available in the specified PHP extension. The function takes as a parameter
a string with the name of the extension. If the extension does not exist or does not contain functions,
the function will return false.
Syntax
get_extension_funcs(string $extension_name);
Example
Let's get a list of all functions of the JSON extension:
<?php
$res = get_extension_funcs('json');
print_r($res);
?>
Code execution result (example):
[
'json_encode',
'json_decode',
'json_last_error',
'json_last_error_msg'
]
Example
Let's try to get functions of a non-existent extension:
<?php
$res = get_extension_funcs('nonexistent');
var_dump($res);
?>
Code execution result:
bool(false)
Example
Let's get the functions of the standard extension (standard PHP functions):
<?php
$res = get_extension_funcs('standard');
print_r(array_slice($res, 0, 5));
?>
Code execution result (first 5 functions):
[
'constant',
'bin2hex',
'sleep',
'usleep',
'time_nanosleep'
]
See Also
-
the
get_loaded_extensions
function,
which returns a list of all loaded extensions -
the
extension_loaded
function,
which checks if the specified extension is loaded -
the
function_exists
function,
which checks for the existence of a function