PHP/Functions/function exists
bool function_exists ( string function_name ) returns true if that function is available for use.
<source lang="html4strict">
<?
if (function_exists("imagepng")) { echo "You have the GD extension loaded."; } else { echo "Can"t find imagepng( ) - do you have GD loaded?"; }
?>
</source>
Testing for a Function"s Existence
<source lang="html4strict">
<html> <body>
<?php
function tagWrap( $tag, $txt, $func="" ) { if ( function_exists( $func ) ) $txt = $func( $txt ); return "<$tag>$txt</$tag>\n"; } function subscript( $txt ) { return "$txt"; } print tagWrap("b", "bold"); print tagWrap("i", "i", "subscript");
?>
</body> </html>
</source>