Re: [RFC] Deprecations for PHP 8.6

From: Date: Thu, 02 Jul 2026 08:21:07 +0000
Subject: Re: [RFC] Deprecations for PHP 8.6
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-131702@lists.php.net to get a copy of this message
Hi Am 2026-07-02 05:51, schrieb Seifeddine Gmati:
array_destruct() that would address the readability argument (which is hard to discuss away because it is hyper subjective).
This can't work, and not for stylistic reasons. Destructuring happens in a *write* context: the construct sits on the left of = and receives bindings. A function can't do that. `array_destruct($a, $b) = $arr` isn't expressible
That specific syntax would indeed not be possible, but the following would work:
    <?php
    function destruct(array $a, &...$results) {
        foreach ($results as $key => &$val) {
            $val = $a[$key];
        }
    }
    destruct([1, 2, 3, 'b' => 'b'], $a, b: $b);
    var_dump($a, $b);
see: https://3v4l.org/ia489n#veol Best regards Tim Düsterhus

« previous php.internals (#131702) next »