Adding elements onto an array
Posted: Thu Dec 07, 2006 8:19 am
I should know the answer to this question and I feel quite embarrassed about asking. If I have an array and I want to add elements onto the array throughout a piece of code, how is it possible. I have the following code at the moment which doesn't give the expected results~:
I was expecting
Code: Select all
$a = array();
$a .= 30;
$a .= 60;
$a .= 200;
print_r($a); # This echos "Array3060200"
echo "\n";
echo count($a); # This echos "1"Regards, StephenArray
(
[0] => 30
[1] => 60
[2] => 200
)