|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-01-06 10:13 UTC] gwendal dot ledoussal at jymeo dot net
Description:
------------
PHP 7.4 deprecated array and string offset access with curly braces but it also affect property name concatenation.
Test script:
---------------
<?php
class Foo {
public function __construct() {
$bar = "bar";
$this->{'foo_' . $bar} = true; // Works
$this->foo_{$bar} = true; // Triggers Array and string offset access syntax with curly braces is deprecated
}
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 05:00:02 2025 UTC |
$this->{"foo_{$bar}"} = true;$this->foo_{$bar} is an array access, as the deprecation warning correctly indicates. It does not concatenate property names.