Im trying to make a function to run it later.
In php 5.3.2-1 it works fine. But in 5.1.6 it doesn't.
The code is:
$func = function(){
echo "Hello!";
};
echo "Before Hello";
$func();
Does anyone knows how to emulate this in 5.1.6?
Thanks.
Eduardo
$func = create_function('','echo "Hello!";');
echo "Before Hello";
$func();
to be able to "assign a function to a variable", while not delving into eval-ish code:
function my_not_so_anonymous_function1()
{
echo "Hello!";
}
$func = 'my_not_so_anonymous_function1';
echo "Before Hello";
$func();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With