object oriented php
Moderator: General Moderators
object oriented php
from which php version object oriented is supported?
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
every last detail is documented hereIn PHP 5 there is a new Object Model. PHP's handling of objects has been completely rewritten, allowing for better performance and more features.
http://us3.php.net/manual/en/language.o ... #op5.intro
and for version 4 of php
http://us3.php.net/manual/en/language.oop.php
for one php5 allows visibility, a significant improvement over 4
In PHP v3 OOP support was added with the addition of the Zend team to the project, and in every release since then it's been improved upon by Zend.
In PHP 4, the OOP model was similar to PHP 3 and it's argued that it was flawed. In PHP 5 however, the model was completely revamped and it has much more robust & extensive OOP support now.
If you've done OOP work in other languages, you'll pick up on the new PHP 5 OOP model easy.
In PHP 4, the OOP model was similar to PHP 3 and it's argued that it was flawed. In PHP 5 however, the model was completely revamped and it has much more robust & extensive OOP support now.
If you've done OOP work in other languages, you'll pick up on the new PHP 5 OOP model easy.
I would say use PHP5 so you're working with a more "real" OOP model. Also I think there's I think an error level in 5 called E_STRICT that will warn you about things like declaring class's variables without visibility, if for some reason this way of declaring variables is deprecated it's going to be more of a pain to upgrade all the legacy code. Even outside of OOP 5 has introduced a lot of new functions that when I used 4 often got frustrated were not available,
file_put_contents for one
I really like the way 5 is going and I think down the road when PHP grows and we get into new versions PHP5 legacy code will be a smoother transition into the newer versions then 4's
If you decide to go with PHP4, the decision really is yours like we already mentioned. In most of my applications I find myself encapsulating common code into classes but then using procedural code to instantiate / use their API. It all depends on your style of coding, the project, and how much you enjoy spaghetti code.
file_put_contents for one
I really like the way 5 is going and I think down the road when PHP grows and we get into new versions PHP5 legacy code will be a smoother transition into the newer versions then 4's
If you decide to go with PHP4, the decision really is yours like we already mentioned. In most of my applications I find myself encapsulating common code into classes but then using procedural code to instantiate / use their API. It all depends on your style of coding, the project, and how much you enjoy spaghetti code.