Re: Re: [RFC] Clone with v2

From: Date: Wed, 21 May 2025 15:33:46 +0000
Subject: Re: Re: [RFC] Clone with v2
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi

Am 2025-05-21 17:27, schrieb Theodore Brown:
Combining named-parameter array() syntax with clone taking a array as the second parameter would allow for the following, which might combine the best of both worlds?
    clone($obj, array(foo: 1, bar: "baz", object: "this is not blocked"));
I really like this idea! If it can work without any function call overhead, it would enable more ergonomic array creation not only for clone() but also in many other common scenarios. Yes, the implementation in the PR comes without any function call overhead. The logic to support the named parameters is purely implemented in the parser. The actual function implementation is provided to “round off” the implementation and because it was super simple to add. Best regards Tim Düsterhus

Thread (41 messages)

« previous php.internals (#127418) next »