Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 2
    In short. 2 is better. Commented Nov 21, 2013 at 6:22
  • I agree and recommend to have a look at ORMs like Doctrine or Propel. And try to avoid arrays whenever possible since they are kind of anti-OOP (e.g. no type hinting)... see the php manual for alternatives like Traversable, Iterator and ArrayAccess. Commented Nov 21, 2013 at 10:00
  • Slight peeve, when you say class creation, you mean object creation. Class creation would be the act of writing the class code. Commented Nov 22, 2018 at 8:09
  • 1
    These are two questions, would you care to separate them into two please? The first one is, should my class store the data from the database as a (presumably raw) single $_data variable or as separate properties? he second one is, should my function return an object or an array? These merit two different answers, since the second one has already been answered, I recommend extracting the first one into its own question. I'll post my answer as soon as you do this. Thanks, and good job on the interesting questions! Commented Nov 22, 2018 at 8:45