clone()
function clone(object $object, array $withProperties = []): object
Creates a shallow clone, then initializes selected properties on the clone.
Parameters:
$object(object)$withProperties(array), default[], optional
Returns: object
Availability
- Compiled (AOT): supported by the Elephc code generator.
eval()(magician interpreter): supported through a declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/symbols/clone.rs).
No examples yet. Check examples/ and showcases/ for usage patterns.
Internals
For how clone is implemented in the compiler, see the internals page.