|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34210 Feature to run function inline within the local scope
Submitted: 2005-08-22 14:42 UTC Modified: 2021-02-15 12:35 UTC
Avg. Score:2.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: jdv at foobar dot be Assigned: cmb (profile)
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5.0.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jdv at foobar dot be
New email:
PHP Version: OS:


 [2005-08-22 14:42 UTC] jdv at foobar dot be
It would be nice to see a feature that allowed for functions to be executed, inline, within the current local scope. The behaviour I intend for is that of eval(). Calling eval($code) allows $code to access variables from the local scope from which eval is called. It also allows $code to set variables in this local scope. Both features, if accessible to user-defined functions, would come in handy on occasions.

One particular useful function that could be built if this functionality existed, would accept a string for argument and replace all %foo occurences in it by the -- according to context -- properly escaped value of $foo. Such a function could then be used for composing HTML and SQL strings more easily.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 23:01 UTC]
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2021-02-15 12:35 UTC]
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-02-15 12:35 UTC]
> Both features, if accessible to user-defined functions, would
> come in handy on occasions.

… to shoot your own feet.  I don't think that this will be
implemented ever, but anybody still looking for this feature
should consider to pursue the RFC process[1].

[1] <>
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed May 25 14:04:06 2022 UTC