12
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Indirect modification of overloaded element って言われる時

Posted at

PHP で配列の値を変更しようとした時、

Indirect modification of overloaded element

と言われれ、変更できない場合があります。
こういう時は、一旦別の変数に代入して変更すると、うまくいきます。

$config = $app['config'];
$config['block_realdir'] = 'block_dir';
$app['config'] = $config;

var_dump($app['config']['block_realdir']);
// => string(9) "block_dir"

See Also

http://stackoverflow.com/questions/20053269/indirect-modification-of-overloaded-element-of-splfixedarray-has-no-effect

12
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?