How to fill an Array (array()); with `dynamic` values.
<?
$vals = array(
array(50, "Titantic", 190, 0 ,0),
array(25, "Second value", 0, 190, 0),
array(15, "Third value", 0, 0 ,190),
array(10, "Fourth value", 0, 190 ,190)
);
?>
Would be:
$vals = array(
array($num,$title,$r,$g,$b),
etc...
);
To put this in a For loop you can do the folowing :
1. To add (append) a new array to $vals,you can use
$vals[] = array(...). this will append a new Array
in the next free spot.
2. to replace the element in offset 7 explicitly you can
do : $vals[7]=array(...).
|