PHP/Functions/create function
A Simple Anonymous Function
<source lang="html4strict">
<html> <body>
<?php
$my_anon = create_function( "$a, $b", "return $a+$b;" ); print $my_anon( 3, 9 );
?>
</body> </html>
</source>
Dynamically Creating Functions
<source lang="html4strict">
<?php if (count($_POST) > 0) {
$prepped = create_function("$a", "return trim($_POST[$a]);");
} elseif (count($_GET) > 0) {
$prepped = create_function("$a", "return strtoupper($_GET[$a]);");
} else {
$prepped = create_function("$a", "return false;");
} echo $prepped("file"); ?>
</source>