13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

528 Chapter 24 Other Useful Features<br />

Getting Information About the <strong>PHP</strong><br />

Environment<br />

A number of functions can be used to find out information about how <strong>PHP</strong> is configured.<br />

Finding Out What Extensions Are Loaded<br />

You can easily see what function sets are available <strong>and</strong> what functions are available in<br />

each of those sets by using the get_loaded_extensions() <strong>and</strong><br />

get_extension_funcs() functions.<br />

The get_loaded_extensions() function returns an array of all the function sets currently<br />

available to <strong>PHP</strong>. Given the name of a particular function set or extension,<br />

get_extension_funcs() returns an array of the functions in that set.<br />

The script in Listing 24.1 lists all the extension functions available to your <strong>PHP</strong><br />

installation by using these two functions.<br />

Listing 24.1 list_functions.php— Lists the Extensions Available to <strong>PHP</strong> <strong>and</strong> the<br />

Functions for Each Extension<br />

<br />

Note that the get_loaded_extensions() function doesn’t take any parameters, <strong>and</strong> the<br />

get_extension_funcs() function takes the name of the extension as its only parameter.<br />

This information can be helpful if you are trying to tell whether you have successfully<br />

installed an extension or if you are trying to write portable code that generates useful<br />

diagnostic messages when installing.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!