|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #517 eval() is not a function
Submitted: 1998-07-07 11:16 UTC Modified: 1998-07-07 11:34 UTC
From: kk at shonline dot de Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0 Final Release OS: Solaris 2.5.1
Private report: No CVE-ID: None
 [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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-07-07 11:34 UTC] zeev
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);

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 10:01:30 2024 UTC