|
adding to an array in php
so i thought i'd write a little quick tip:
lets call this array $fruit
now i have 2 pieces of fruit in this array already .. there are 2 ways i can add another piece of fruit to the end of the array.
this is what we have:
$fruit[0]="apple";
$fruit[1]="pear";
now to add a bannana, i can do it one of 2 ways:
$fruit[]="bananna";
or
array_push($fruit,banna);
=-===========
i forgot how to add to the end of an array earlier and re-learned that today .. thought i'd pass it along.
-mike
|