3

I building a website in php where I'll have to make User, Case & Task classes, each of which going to have couple of methods. In my index.php I'll need to do some CRUD operation that I've wrote in my classes. So which is better to call a method and send parameters to like Case::update(2) or its better to instantiate the class first then call a method like

$case = new Case();
$case->update(2); 
Ansd
  • 1,865
  • 3
  • 19
  • 30

1 Answers1

3

Well, as KingCrunch already mentioned in the comments, it totally depends on your whole architecture. Furthermore, it also depends on your preferences. If you read through the following links you may have a better overview and can choose for yourself:

Community
  • 1
  • 1
Sascha Galley
  • 15,711
  • 5
  • 37
  • 51