Jump to content

OOP PHP?


Jessica

Recommended Posts

I'm having trouble understanding the concept of OOP and non-OOP programming. I was taught that PHP is an OOP language, yet someone is telling me they can code PHP without it being OOP. Can someone please explain OOP in an easy to understand way, and if PHP can be non OOP, an example?
Link to comment
Share on other sites

Honestly OOP (or Object-Oriented Programming), at least from my perspective is a time saver. Yes, you can write out the code, but if you happen to have to repeat the code or use the same function more than once it helps to have it in a form that you don't have to rewrite it.

I'm sure there are some different answers than just mine... but that's how I interpert it.
Link to comment
Share on other sites

Sorry, maybe I didn't ask clearly enough. I know there are advantages to using OOP, but I don't understand what it is. It's classes & functions, having objects...but I don't know how you would write PHP without those things.
Link to comment
Share on other sites

(others can have a different take on this... so please don't chew me out for saying this... but i'm going to say it anyways...)

PHP was designed to look and behave very similiarly to programming in C. Basically if you had a large program that needed to be run... it would be more benifitial to you in the long run to use OOP. They say that a picture is worth a 1000 words... so I hope that this helps more than i can explain.

[img src=\"http://www.tornadopixel.com/images/thecode.jpg\" border=\"0\" alt=\"IPB Image\" /]

I hope that this helps some...
Link to comment
Share on other sites

I've been programming for the past 25+ years and in all this time and in all the languages I've used I've only ever learnt what I need to know when I need it. This way I've picked up some languages with ease. I've never known many of the fancy terms like OOP and classes.

I've just had to dig this up usign Google:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]OOP, Oops. Object-oriented programming. A method of computer programming where items of related data together with routines associated with it are treated as a single 'object' or item in the program. For example, to implement an on-screen dialogue box requires graphic images for the box and its buttons, details of how they are to be arranged, and a facility to detect which button has been pressed. All of these would be combined into a self-sufficient object which would take as input, the name of the dialogue, perhaps some text to be displayed and the names of the buttons, and return as output a code indicating which button had been pressed. The advantage of OOP is that manipulation of the defined object can be made much easier for the programmer. Languages such as C++ provide special features to assist OOP.[/quote]

Always been a bit of a grey area for me.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.