php 5 code -> php 4

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sam159
Forum Newbie
Posts: 5
Joined: Wed Oct 04, 2006 11:09 am
Location: Hull, UK

php 5 code -> php 4

Post by sam159 »

Hi all,
ive been writing a php 5 app, and testing on my machine, but ive realised that my host is using php 4.4.3 :(

So, im gonna have to downgrade the code to php 4 oo stuff.
Im guessing the differences are:
- No access modifiers
- Constructor is class name

Is there anything else?

Thank you

Sam
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

lots...
http://www.zend.com/php5/articles/engin ... hanges.php
I'd say this is one of the most significant (if not the most)
http://www.zend.com/php5/articles/engine2-php5-changes.php wrote:PHP's handling of objects has been completely rewritten, allowing for better performance and more features. In previous versions of PHP, objects were handled like primitive types (for instance integers and strings). The drawback of this method was that semantically the whole object was copied when a variable was assigned, or pass as a parameter to a method. In the new approach, objects are referenced by handle, and not by value (one can think of a handle as an object's identifier).
sam159
Forum Newbie
Posts: 5
Joined: Wed Oct 04, 2006 11:09 am
Location: Hull, UK

Post by sam159 »

The Ninja Space Goat wrote:lots...
http://www.zend.com/php5/articles/engin ... hanges.php
I'd say this is one of the most significant (if not the most)
http://www.zend.com/php5/articles/engine2-php5-changes.php wrote:PHP's handling of objects has been completely rewritten, allowing for better performance and more features. In previous versions of PHP, objects were handled like primitive types (for instance integers and strings). The drawback of this method was that semantically the whole object was copied when a variable was assigned, or pass as a parameter to a method. In the new approach, objects are referenced by handle, and not by value (one can think of a handle as an object's identifier).
Thanks Ninja Space Goat :)

lucky i dont do much object copying.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

Code: Select all

$obj1 = new ojb1;
$obj2 = new obj2;
// In PHP4 his would make a copy
$obj2->do_something($obj1);
// So would this
$obj3 = $obj1;
Post Reply