Discuss Object Oriented vs Prodedural (Opinionated) in the PHP Development forum on Dev Shed. Object Oriented vs Prodedural (Opinionated) PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
Posts: 297
Time spent in forums: 3 Days 8 h 45 m 39 sec
Reputation Power: 5
Object Oriented vs Procedural (Opinionated)
Hey all. I am working on updating my work from the depreciated mysql_ to the mysqli_ and see the 2 styles being defined. I'm used to the Procedural style, but was wondering what everyone's opinion was with maybe switching to the Object Oriented style as well while updating myself to the mysqli_...
Last edited by Triple_Nothing : December 3rd, 2012 at 12:48 PM.
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Posts: 1,875
Time spent in forums: 1 Month 2 Weeks 2 Days 4 h 2 m 23 sec
Reputation Power: 813
Hi,
it depends on your application. If it's object oriented, use the object oriented API. Otherwise use the procedural API.
None of them is "better" than the other. Calling $db->query() instead of mysqli_query() doesn't make your application "more modern" or "cleaner". The different APIs just account for that fact that there are different programming paradigms in PHP.