minwork/array
Minwork Array provides fast, well-tested helpers for nested, associative, and object arrays. Get/set/has plus map, filter, find, group, sort, and validation, with fluent-style chaining. No dependencies; modern PHP syntax.
Arr::clone(array $array): array
Copy array and clone every object inside it
$object = new class() {
public $counter = 1;
function __clone()
{
$this->counter = 2;
}
};
$array = [
'foo',
'bar',
$object,
'test',
'nested' => [
'object' => $object
]
];
$cloned = Arr::clone($array);
$cloned[0] -> 'foo'
$cloned[2]->counter -> 2
$cloned['nested']['object']->counter -> 2
How can I help you explore Laravel packages today?