defining an initial variable in a new object in php -


i new oop forgive me if question flawed.

i writing class fetch , populate data set, performed within loop, return series of index id's populate data of object. within app, need both in loop, , individually. question when (inside or outside loop) initiate class, how define id particular object's item id, used class's methods?

$object = new item($itemid); // or $object = new item->4; // ? 

i not sure how this, or if proper way handle kind of logic.

sidenote

i writing class under assumption first object collection of commonly used functions exist such, trying clean things up.

you need initialize class, , set item id.

$object = new item(); $object->item_id = 1; 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -