|
Posted by Bent Stigsen on 05/19/06 21:30
Paul wrote:
[snip]
> for ($i = 0; $i < 3; ++$i)
> {
> $newpos += strpos($lineleft, "*");
> array_push($line, substr($datein, $pos, $newpos));
> $newpos++;
> $lineleft = substr($datein, $newpos, strlen($datein) - $newpos);
> $pos = $newpos;
> }
Small oops, your loop only runs three times, but later you expect $line to
contain 4 values. Unless you have some special plan with the code above,
you could get the same result by just using:
$line = split("\*", $datein);
[snip]
> if ($year >= $today['year'])
> {
> if ($month >= $today['mon'])
> {
> if (($month == $today['mon']) && ($day <= $today['mday']))
> continue;
> $datet = $day ."-" .$month."-".$year;
> array_push($event['Date'], $datet);
> }
> }
> array_push($event['Time'], $line[1]);
> array_push($event['Venue'], $line[2]);
> array_push($event['Event'], $line[3]);
In some conditions $event['Date'] does *not* get an value, while the others
(Time, Venue, Event) do. For instance if $year < $today['year']. I assume
it is not what you intended.
[snip]
> I know the substr stuff works (I can test that and it's fine and dandy).
> I know the $month et al works as well (I've cut and pasted it from a
> website I run at work). However, I'm not at all sure that how I'm using
> the empty arrays (especially the multi-dimension array) is correct.
Use of array_push looks fine.
You could use syntax like $event['Event'][] = $line[3], but the result would
be the same.
/Bent
[Back to original message]
|