Okay so I m fairly new to PHP and I am currently experimenting with arrays. As an example, lets assume this is my array:
$t1 = array (
"basicInfo" => array (
"The Sineps",
"December 25, 2010",
"lemonpole_1g"
),
"overallRecord" => array (
"23",
"12",
"19",
""
)
);
From what I could gather, I found out that the function array_splice allows me to point to a specific index in the array and add/remove data. From all of the examples that I ve seen using this function...only numeric arrays were used. Now my question is how would I point to ["overallRecord"][3](which is empty) for example, and update that field?
For further understanding that empty field is for "total points":
$wins = $t1["overallRecord"][0] * 3;
$loss = $t1["overallRecord"][1];
$draw = $t1["overallRecord"][2];
$total = $wins + $draw;
So to sum it all up, I d like to add the variable $total to ["overallRecord"][3]. It doesn t necessarily have to be with array_splice, however, if you come up with a different method to achieve this try and keep it simple or add comments please :)
Thanks in advance!