|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[1998-07-07 11:16 UTC] kk at shonline dot de
eval() is not a function (despite the required notation), thus I can't write
$var = "o->slot[10]";
$a = eval("\$".$var.";");
to access $o->slot[10]. I also can't use $$var. I could use a temporary variable
within the eval statement, but this would create a copy of $o->slot[10], which
is no good, if $o->slot[10] is a slice of a multidimensional array.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 16:00:02 2025 UTC |
eval() is indeed not a function, and it's never going to be a function either. Think about it for some more time, and you'll see that what you suggested makes no sense. eval() is comparable to include() or require(), or even exec(). It executes code. It doesn't evaluate expressions and returns their value, it evaluates code and executes it. What you want instead of $foo = eval($something); is eval("$foo=$something;");