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

phpget_extension_funcs(string $extension_name);

Example

Let's get a list of all functions of the JSON extension:

php<?php
  $res = get_extension_funcs('json');
  print_r($res);
?>

Code execution result (example):

php[
  'json_encode',
  'json_decode',
  'json_last_error',
  'json_last_error_msg'
]

Example

Let's try to get functions of a non-existent extension:

php<?php
  $res = get_extension_funcs('nonexistent');
  var_dump($res);
?>

Code execution result:

phpbool(false)

Example

Let's get the functions of the standard extension (standard PHP functions):

php<?php
  $res = get_extension_funcs('standard');
  print_r(array_slice($res, 0, 5));
?>

Code execution result (first 5 functions):

php[
  'constant',
  'bin2hex',
  'sleep',
  'usleep',
  'time_nanosleep'
]

See Also