|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-02-08 21:20 UTC] quinn at quinn dot student dot utwente dot nl
Description:
------------
According to the documentation a return in eval should return the value passed to the return statement.
This works fine outside functions or classes. But when you want to eval a function or a function in a class this does not work.
Reproduce code:
---------------
class aap{
static function aap1(){
return 'aap';
}
}
function text(){
return 'text';
}
$a = eval('text();');
echo $a;
$b = eval("return 'output';");
echo $b;
$c = eval("aap::aap1();");
echo $c;
Expected result:
----------------
text output aap
Actual result:
--------------
output
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 18:00:01 2025 UTC |
Sorry to have bothered anyone with this :( i forgot the scope i should have returned the value in the eval. like: eval("return text();");