php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kk at shonline dot de
New email:
PHP Version: OS:

 

 [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.

Patches

Pull Requests

History

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);
is
eval("$foo=$something;");

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 06 19:01:27 2024 UTC