php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jdv at foobar dot be
New email:
PHP Version: OS:

 

 [2005-08-22 14:42 UTC] jdv at foobar dot be
Description:
------------
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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 23:01 UTC] cmb@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2021-02-15 12:35 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-02-15 12:35 UTC] cmb@php.net
> 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] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC