When I started learning OOP programming, I read that this is all an object. In most cases, I develop in PHP. Arrays play an important role here. In languages like C #, in most cases you really need to use and pass objects, not arrays.
For instance:
Class Product { private $data = array(); public function __construct() { $this->data['setting_1'] = 'a'; $this->data['setting_2'] = 'b'; $this->data['setting_3'] = 'c'; $this->data['setting_4'] = 'd'; $this->data['setting_5'] = 'e'; } }
Does it make sense to create classes for everything when you use PHP? For instance:
Class Product { private $setting_1, $setting_2, $setting_3, $setting_4, $setting_5; }
And then create an instance of the Product class in another class (for example, Model) and return the object instead of an array (for example, in the controller)?
source share