Req #65919 [NEW]: Method of Only Execute Functions in an Array Variable When Requested
| From: | admin at skid dot pro | Date: | Wed, 16 Oct 2013 19:37:03 +0000 |
| Subject: | Req #65919 [NEW]: Method of Only Execute Functions in an Array Variable When Requested | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-182320@lists.php.net to get a copy of this message | ||
From: admin at skid dot pro
Operating system: Irrelevent
PHP version: Irrelevant
Package: Arrays related
Bug Type: Feature/Change Request
Bug description:Method of Only Execute Functions in an Array Variable When Requested
Description:
------------
I seem to be pushed into a wall where I require an array to only execute
functions (in-line and in general) in an array value if it's requested.
I realize that I may be able to do this via OOP and ArrayAccess, however
I find it's not actually able to provide me with what I need. See the
test script for an example of what I'm aiming for.
Test script:
---------------
<?
$var = "Before";
function getVar(){
global $var;
return $var;
}
$array = Array(
"variableA" => "A: " . getVar(),
"variableB" ~> "B: " . getVar() //~> in place of =>
);
$var = "After";
echo $array['variableA']; //Would echo 'A: Before'
echo $array['variableB']; //Would echo 'B: After'
?>
Expected result:
----------------
$array['variableA'] Would equal 'A: Before'
$array['variableB'] Would equal 'B: After'
--
Edit bug report at https://bugs.php.net/bug.php?id=65919&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65919&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65919&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65919&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65919&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65919&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65919&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65919&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65919&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65919&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65919&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=65919&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=65919&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65919&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65919&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65919&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65919&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65919&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65919&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65919&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65919&r=mysqlcfg