Hello. I am curious if it is possible to create functions dynamically in such a way, that (1) the names of the functions to be retrieved from an array and (2) these names could be used also inside the functions. I have a code that is solving the first problem, any ideas how to solve problem 2? Thanks.
<?php
$myarray = ['myvalueone','myvaluetwo','myvaluethree','myvaluefour','myvaluefive'];
for($i=0, $n=count($myarray); $i<$n; $i++)
{
$functionname = $myarray[$i];
$$functionname = function(){
echo 'The name of the function is ... .';
};
}
$myvaluetwo(); // The result need to be: The name of the function is myvaluetwo.
?>