get_extension_funcs GETS an ARRAY with the names of the functions of a module.
<?php
array|false get_extension_funcs ( string $extension )
where,
$extension = Name of the extension to be checked
One of the extension names
obtained through the function:
get_loaded_extensions
?>
$extension
The module name to get the extension functions.
In order to have a complete list of all the functions available in each of the installed extensions, we use get_loaded_extensions which provides the names of said extensions in the format of an ARRAY.
<?php
array get_loaded_extensions([ bool $zend_extensions = FALSE ] )
where,
$zend_extensions = if TRUE only return Zend extensions
The default, FALSE return regular extensions
?>
So, we use get_extension_funcs to know the names of the functions available in each extension.
Therefore, run the next exercise to see what functions are available in each extension present in your system.
For arbitrary precision mathematics PHP offers the Binary Calculator which supports numbers of any size and precision up to 2147483647, (or 0x7FFFFFFF), decimals, if there is sufficient memory, represented as strings.
We will study all MATHEMATICS functions available in the bcmath extensions.
As this depends on the PHP version, run the next exercises on your system.
EXERCISE
<table width="100%" cellspacing="3" cellpadding="3"
border="1" align="center">
<tbody><tr><td colspan="2">AVAILABLE FUNCTIONS</td></tr>
<tr><td>NAME</td><td>LIBRARY</td></tr>
<?php
// The result of this exercise will depend
// of the configuration of your system
$exts = get_loaded_extensions ();
foreach ( $exts as $xt) {
$exts01 = get_extension_funcs ($xt);
if( $exts01 != FALSE) {
foreach ( $exts01 as $func ) {
echo '<tr><td>' . $func . '</td><td>' . $xt . '</td></tr>';
} } }
?>
<tr><td colspan="2">ed48</td></tr></tbody></table>
EXERCISE
<?php
$ext = "bcmath";
// The result of this exercise will depend
// of the configuration of your system
// The module name to get the extension functions,
// in this case: bcmath (case insentive)
if(extension_loaded($ext))
{
echo '<table width="100%" cellspacing="3"
cellpadding="3" border="1" align="center">
<tbody><tr><td colspan="2">
AVAILABLE bcmath FUNCTIONS</td></tr><tr><td>NAME</td>
<td>EXT</td></tr>';
$mod = get_extension_funcs ($ext);
foreach ( $mod as $k => $xt)
{
echo '<tr><td>( ' . ($k+1) . ' ) ' . $xt . '</td><td>' . $ext . '</td></tr>';
}
echo '<tr><td colspan="2">ed48</td></tr></tbody></table>';
}
else
{
echo 'The extension "' . $ext . '" is NOT loaded!<br>';
exit;
}
?>
RESULT
bcmath FUNCTIONS |
ORD | NAME |
1 | bcadd |
2 | bcsub |
3 | bcmul |
4 | bcdiv |
5 | bcmod |
6 | bcpowmod |
7 | bcpow |
8 | bcsqrt |
9 | bccomp |
10 | bcscale |
ed48 |