Mega Code Archive

 
Categories / Php / Functions
 

Testing for a Functions Existence

<html> <body> <div> <?php     function tagWrap( $tag, $txt, $func="" ) {       if ( function_exists( $func ) )         $txt = $func( $txt );       return "<$tag>$txt</$tag>\n";     }          function subscript( $txt ) {       return "<sub>$txt</sub>";     }          print tagWrap('b', 'bold');          print tagWrap('i', 'i', "subscript");     ?> </div> </body> </html>