why doesn’t this work?
$arr=array(
7,
'h',
function($text){echo $text;}
);
$arr[2]('some text');
I want it to echo ‘some text’ but it says that there is an unexpected T_FUNCTION.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Anonymous functions have been added in PHP 5.3.0 to my knowledge. This error seems to indicate that the version you’re using doesn’t support them.