-1

I'm a beginner in PHP but I know a lot of stuff (procedural). I just want to know if object oriented PHP does the same thing as procedural.

Basically I'm planning to make a social site and I'm wondering which would be the best to use (if they do the same thing).

Naincy
  • 2,953
  • 1
  • 12
  • 21
babyleans
  • 23
  • 2
  • 9
  • They are different approaches to writing your code, so while you can write a script to display 'Hello World' in both approaches, the actual code you write in each case will be different – Mark Baker Sep 24 '14 at 10:22
  • Yes, they do the same thing, i.e. get work done, but albeit differently. – Ali Gajani Sep 24 '14 at 10:23

1 Answers1

1

They are different approaches to the same problem.

However, for large projects you really don't want to go procedural. Mixing OO code with a good design pattern like MVC (Model-view-controller) is the way you want to go, as it is easier to maintain and expand. it also allows you to develop reusable classes and methods instead of rewriting the same thing over and over again - the DRY (Don't repeat yourself) principle. I tend to use this MVC framework for a lot of the smaller systems I write, and it's useful as an introduction to both OO and MVC.

iamgory
  • 862
  • 1
  • 6
  • 10