I need to build a class with many variables directly from the database. For simplicity, we will call them "userX", I studied ORM a bit, but on my way.
Essentially, I thought I could use my procedural code
for ($i=0; $i<100; $i++) { public ${'user'.$i}; }
But in the classroom
class test() { private $var1; for ($i=0; $i<10000; $i++) { public ${'user'.$i}; } function __constructor ..... }
Obviously not .. but this leaves me with the same problem as I can add $ user0, $ user1, $ user2 etc. etc. without typing them in 10k.
Obviously, it would be easier to just grab the names from the database, but, again, this looks even more difficult for the code. Should I buckle up and grab their entire ORM style?
source share