Is there a function to make a copy of a PHP array to another?

Technology CommunityCategory: PHPIs there a function to make a copy of a PHP array to another?
VietMX Staff asked 4 years ago

In PHP arrays are assigned by copy, while objects are assigned by reference so PHP will copy the array by default. References in PHP have to be explicit:

$a = array(1,2);
$b = $a; // $b will be a different array
$c = &$a; // $c will be a reference to $a