Code: Select all
$array1 = array();
$secondArray = array();
echo "array1 has " . count($array1) . " elements<crlf>secondArray has " . count($secondArray) . " elements";
$array1ElementCount = explode($array1, "element1|element2|element3");
echo "array1 has " . count($array1) . " elements<crlf>secondArray has " . count($secondArray) . " elements";
echo
reports that each array has 0 elements, as expected.However, the second
echo
reports that each array now has 3 elements. It seems that $array1
and $secondArray
are the same array.I'm expecting to have 2 separate arrays, not 2 variables pointing at the same array. Have I misunderstood what the
array()
function does, or made another error?