Hey i can do that in $php too!
function execute($order, $callbacks){
foreach($order as $i){
$callbacks[$i]();
}
}
function abcProcs(){
foreach(func_get_args() as $f){
eval("function $f() { echo '$f'; };");
}
}
abcProcs("A","B","C");
execute([0,0,1,2,1,2], ['A','B','C']);
edit:you don't have to quote the function names (just to show they are really functions and not closures):
execute([0,0,1,2,1,2], [A,B,C]);