Posted by Chung Leong on 10/28/81 11:33
Probably easier to just remember the previous value as your loop
through the array.
$prev_value = -1;
$prev_date = 0;
foreach($close as $date => $value) {
if($prev_value >= 0) {
// draw line from closing value from previous date
// current value
}
else {
$first_date = $date;
}
$prev_value = $value;
$prev_date = $date;
}
I'm using the date as the index here, since that'll probably be needed
for drawing the chart.
[Back to original message]
|