ok... so, since we are talking about arrays, let's try another scenario, and bit more complicated one at that...
I need to do this in order to spit the array at a pie chart. since i'm having a lot of dynamic values, i can't specify exactly how many arrays to use since it will vary from time to time.
i define the variable $data ( which the pie chart uses to determine how to draw the chart ) like this :
Code: Select all
$data = ('Hello' => 45, 'Something' => 55);
where hello is var one, and 45 is the actual percentage ( so it knows how big of a slice to cut in the pie ).
In the actual function that this pie chart derrives in, it's calling $data ( that you pass it ) $data_array, and splits it like this :
Code: Select all
foreach($data_array as $var=>$val)
{
$data_set[$var][0] = $val;
$data_set[$var][1] = (360/$data_sum)*$val;
so, here lies my problem. let's say i have $date and $time.
Only this time, i'm wanting to index $date to $time into an array called $data.
so i'm wanting to do :
(with $time being an array of 3 times, and $date being an array of 3 dates )
while hoping to get a result of :
Array(
[20031010] => 110505, [20031111] => 040048 )
HOWEVER, when I do it like this, all I get is a blank Array :
Array ()
with no data in the array. Why is this occuring ? Am I missing something here ?
I mean, I know I can do something like
Code: Select all
for($i=0; $i<=count($date); $i++)
{
$result[] = array($date[$i] => $time[$i]);
}
but this numbers the array insteads of creating indexes of the values for date.
any help would seriously be appreciated...