So I've been writing this class in php (first timer) that has a function that returns a function based on a parameter and it looks something like this:
$f=function($a){
return function($b){
return $a.$b;
};
};
echo $f('a')('b');
but I can't figure out why it doesn't do what I want. Does anyone know the best way to do this?
Basically I need to write a function that takes a string ($type) and writes a function that takes some other strings and turns them into a html input like so:
public static function InputFormat($t){
return function ($f, $p, $e){
return
"<div class='inputformat' id='".$f."'>".
"<ul>".
"<li id='namefield'>".$f."</li>".
"<li id='input'><input name='".$f."' type='".$t."' value='".$p."'></li>".
"<li id='error'>".$e."</li>".
"<ul>".
"</div>";
};
}