I could use a little more confidence about this subject before I go build my project.
I think a big advantage to using classes is to be able to structure your data logically in such a way that you can manipulate the data with ease - specifically I want to pass an object to a new page, rather than pass the 50 attributes individually. Furthermore, I'd like to make an array of the objects, and just pass the array.
Can I create an array of objects, and then store them in a single session variable? Then I can retrieve my array of objects from any pages, rather than make a trip to the db to load everything again?
If so, how does this look:
require_once('classdefs.php');
$car[1] = new clsAuto('vw', '337', '2002');
$car[2] = new clsAuto('vw', 'gti', '2003');
$fleet[1] = new clsAutoCollection();
$fleet[1]->addAuto(car[1]);
$fleet[1]->addAuto(car[2]);
$_SESSION['gfleet'] = $fleet;
I'm not concerned about the exact syntax; I just want to know if the concept will work. Thx.
persistant object array?
Moderator: General Moderators