Is possible to make for loop function for php, that works like this
function hit(){
}
function forLoop($function, $times) {
for($x = 0; $x < $times; $x++) {
$function;
}
$this->forLoop($function, 5);
Is possible to make for loop function for php, that works like this
function hit(){
}
function forLoop($function, $times) {
for($x = 0; $x < $times; $x++) {
$function;
}
$this->forLoop($function, 5);
This can be done with the call_user_func
function:
function hit(){
echo "hello !";
}
function forLoop($function, $times) {
for($x = 0; $x < $times; $x++) {
call_user_func($function);
}
}
forLoop('hit', 5);