programmer programmer - 4 months ago 5x
PHP Question

How can i assign an array to another variable in php?

i have defined an array in php

$letters = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","W","V","X","Y","Z");

Then i try to assign the array to a new variable that is going to be an array and i do:

$new_array = array();
$new_array = $letters;

But it's not working, why?


You can just do

$new_array = $letters;

You don't have to specify the type because it is implied.