Re: clone and new language construct consistency
| From: | Nikita Popov | Date: | Mon, 05 Oct 2015 07:51:30 +0000 |
| Subject: | Re: clone and new language construct consistency | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88675@lists.php.net to get a copy of this message | ||
On Mon, Oct 5, 2015 at 9:48 AM, Gauthier Delamarre <gdelamarre@gmail.com>
wrote:
> Hi all,
>
> I once suggested to some core developers to offer « clone » the same
> syntax as « new » has since 5.4.
>
> The idea being to be able to write this kind of code:
>
> $foo = new Foo;
> $bar = (clone $foo)->someMethod();
>
> It seemed that this would not be that difficult to implement, and I was
> told that a RFC will be created for that purpose.
>
> As I can’t find any RFC for that, I was wondering whether I should create
> one myself or if I just didn’t find it :)
>
Support for this was part of the UVS RFC (
https://wiki.php.net/rfc/uniform_variable_syntax),
so this will work in PHP
7 :)
Nikita