This is for anyone who was following this post, I found a work-around for
the problem I was having with my array of objects.

The original code looked like this:

function getEvents($filename) {
//string $filename
  $event_list = array();
  $event_object = new event();
  $i = 0;

  @ $fp = fopen($filename, "r");
  if(!$fp) {
    echo "<p><strong>Cannot open ".$filename." for reading
mode...</strong></p>";
    exit;
  }
  while(!feof($fp)) {
    $temp = fgetcsv($fp, 1024, ":");
    $event_list[$i] =
$event_object->init($temp[0],$temp[1],$temp[2],$temp[3],$temp[4],$temp[5],$t
emp[6],$temp[7],$temp[8]);
    $i++;
  }
  fclose($fp);

  return $event_list;
}

The modification was in how I was loading the array, instead of just putting
$event_list[$i] equal to the object, I pushed it onto the array using
array_push().  Now, it works great without any errors. The modified code
only pertained to the while loop, the modified code looks like this:

    while(!feof($fp)) {
      $temp = fgetcsv($fp, 1024, ":");
      if(!$temp) break;

$event_object->init($temp[0],$temp[1],$temp[2],$temp[3],$temp[4],$temp[5],$t
emp[6],$temp[7],$temp[8]);
      if(!array_push($event_list, $event_object)) break;
    }

Hope this can be of help to someone.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to