Specifications

The get_loaded_extensions() function returns an array of all the function sets currently
available to PHP. Given the name of a particular function set or extension,
get_extension_funcs() returns an array of the functions in that set.
The script in Listing 21.1 lists all the functions available to your PHP installation by using
these two functions.
LISTING 21.1 list_functions.phpThis Script Lists All the Extensions Available to PHP, and
With Each Extension, Provides a Bulleted List of Functions in that Extension
<?
echo “Function sets supported in this install are:<br>”;
$extensions = get_loaded_extensions();
foreach ($extensions as $each_ext)
{
echo “$each_ext <br>”;
echo “<ul>”;
$ext_funcs = get_extension_funcs($each_ext);
foreach($ext_funcs as $func)
{
echo “<li> $func”;
}
echo “</ul>”;
}
?>
Note that the get_loaded_extensions() function doesnt take any parameters, and the
get_extension_funcs() function takes the name of the extension as its only parameter.
This information can be helpful if you are trying to tell whether you have successfully installed
an extension.
Identifying the Script Owner
You can find out the user who owns the script being run with a call to the
get_current_user() function, as follows:
echo get_current_user();
This can sometimes be useful for solving permissions issues.
Finding Out When the Script Was Modified
Adding a last modification date to each page in a site is a fairly popular thing to do.
Advanced PHP Techniques
P
ART IV
452
26 7842 CH21 3/6/01 3:41 PM Page 452