Req #34210 [Opn->Wfx]: Feature to run function inline within the local scope

From: Date: Mon, 15 Feb 2021 12:35:01 +0000
Subject: Req #34210 [Opn->Wfx]: Feature to run function inline within the local scope
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232164@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=34210&edit=1 ID: 34210 Updated by: cmb@php.net Reported by: jdv at foobar dot be Summary: Feature to run function inline within the local scope -Status: Open +Status: Wont fix Type: Feature/Change Request Package: Scripting Engine problem Operating System: Linux PHP Version: 5.0.4 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: > 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> Previous Comments: ------------------------------------------------------------------------ [2005-08-22 14:42:26] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=34210&edit=1

« previous php.bugs (#232164) next »