0

i want to know tha is object oriented php is better or simple php?
n which version of php is better yet easy to learn?
how much is it different from normal structured php?

4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by _Rade
0

Object oriented programming is definitely better than the structured programming because of the main feature of "CODE RE-USABILITY".
You should try PHP 5 for Object oriented programming.
It is definitely different from structured programming but it's logical and easy to understand.

This is an article about Object Oriented PHP:

http://www.devarticles.com/c/a/PHP/Object-Oriented-Programming-in-PHP/

This is a basic tutorial for beginners

http://www.codewalkers.com/c/a/Programming-Basics/Beginning-Object-Oriented-Programming-in-PHP/

Thanks

0

There is no comparison between OOP and structural php programming in my mind. OOP is composed of most of the concepts and functionality that is "structural" programming. OOP does not magically make your code more maintainable and it does not make it any more organized. A good understanding of the purpose of the application and a good plan will benefit your application far more than choosing one over the other. Most arguments over which is the best way to code, are open ended. Many times it depends on your environment, your hardware, your usage and needs etc. Use the tool that is best suited to the task at hand.

As far as PHP versions, right now I'd say learn under the assumption that you will have full access to 5.2.13. Look at and learn the 5.3 features because that is the future of PHP but its installation base doesn't justify developing specifically for it yet. Besides 5.2 or 5.3 there is no reason to still be supporting PHP4 as it is dead in terms of development and updates.

For references look at the php manual. It is invaluable. http://php.net/manual/en/language.oop5.php

0

@mschroeder: Nail on head.

Switch vs if else if? array vs seperate vars? It's all up to you. The more tools you have at your disposal the better, but don't use them for the sake of it.

It is the concepts that define OOP - the idea of reusable objects, in some cases it will make sense to use this style, in other cases you would just be making life difficult for yourself.

The PHP manual can be a bit daunting when it comes to picking up concepts, but is the definitive resource.

The only way to decide which approach you should use is to have an understanding.

I strongly recommend having a look at the tutorial I suggested previously ( http://www.killerphp.com/tutorials/object-oriented-php/ ) as it has been written for people who are not familiar with the concepts, which can be hard to grasp "as you go along". Check it out, it will get you running your own OO PHP in minutes, and does a good job of explaining seemingly abstract concepts.

Once you've absorbed the content, you will see how it can benefit you in some cases, and inversely could be a waste of time in others.

- Become familiar with the options available to you and the problem will dictate the solution :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.