Possible Duplicate:
OOP vs Functional Programming vs Procedural
Lately I've been introduced to the OO approach, so far i've been writing PHP using functions.
Now, honestly, I don't really get it: When I use the 'Function' idea, I just include a file named, for example, functions.php that has all the functions that I need including the vars, and when I need to use that piece of code, I just call it and set the vars, or leave it empty if there is default vars.
now as far as I understand OO, Instead of writing a lot of functions with no 'category', I just gather them around in a 'class' (for example all the functions for working with a db would be under 'db' class) - and instead of giving them vars, I declare those vars upfront in the class.
so, it feels like I'm basically doing the same thing. I know that the vars are not global in OOP, and they are per instance, which is OK for making more understand-able code, but besides that, I can't really feel a big difference in doing:
$html = new html();
$html->src='http://stackoverflow.com';
$html->desc='Great place to learn & share knowledge';
$html->link();
--
html_link('http://stackoverflow.com','Great place to learn & share knowledge');
I agree that it might be more readable for someone who didn't write that code, but can't see the big benefits everybody talking about: reuse, organized, faster and so on.
Share your thoughts and maybe I'll understand how can I benefit from OOP :)
Thanks in advance, Eek.