Reply to Multi dimension arrays

Your name:

Reply:


Posted by Paul on 05/19/06 14:07

Hi,

This is probably a no-brainer, but I could do with some help here.

I have some code which looks like this

$event = array("Date"=>array(), "Time"=>array(), "Venue"=>array(),
"Event"=>array());
$line = array();

while (!feof($fp))
{
$datein = fgets($fp, 200);
$lineleft = $datein;
$newpos = 0;
$pos = 0;
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;
}
$month = substr($line[0], 5, 2);
$day = substr($line[0], 8, 2);
$year = substr($line[0], 0, 4);
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]);
}
fclose ($fp);

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.

Could someone give me some advice on this?

Thanks

TTFN

Paul
--
"Logic, my dear Zoe, is merely the ability to be wrong with authority" -
Dr Who

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация