I am trying to return the value of self calling function into variable that I will use later but get the following error Parse error: syntax error, unexpected T_FUNCTION, expecting ‘)’
any idea what am i doing wrong? Is it the way to do that? Here is the code:
$clientText = call_user_func(function(){
if($lang == 'en'){
return <<<END
<p>hello world</p>
END;
} else {
...
}
});
thank you.
update
Just found that my php version is 5.2. Is it still possible to do something like that?
Under php 5.2:
Nothing can stop you define the function and then call it.
Or just do it: