|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-10-16 20:03 UTC] requinix@php.net
-Status: Open
+Status: Wont fix
[2013-10-16 20:03 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 15:00:01 2025 UTC |
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'