Re: Re: Trouble interpreting error message

From: Date: Thu, 10 Dec 2015 01:35:19 +0000
Subject: Re: Re: Trouble interpreting error message
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-325280@lists.php.net to get a copy of this message
On Wed, Dec 9, 2015 at 6:23 PM, Jeffry Killen <jekillen@prodigy.net> wrote: > Hello, again: > > In the original post I was trying to apply anonymous code to a static > member array. > > self::$_runList[$_what] = $_code; > $_out = self::$_runList[$_what]($_params); // >>> line # 27 > referred to in error message > > What is now working is to use a locally declared array inside run() > instead: > > $_runList = array() > $_runList[$_what] = $_code; > return $_runList[$_what]($_params); > > Apparently, php doesn't like doing this with a static member array > variable. > > Thanks to anyone who spent some time with the original post. > JK > > > > > You appear to be using a 5.x version of PHP. This is an associativity problem and can be resolved by upgrading to PHP7. Here is your original code, you can see it works in PHP7, and produces and notice followed by a fatal error in PHP<7 https://3v4l.org/Zu1jO For more information, see http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect

« previous php.general (#325280) next »