Page 1 of 1

php 5 code -> php 4

Posted: Wed Oct 04, 2006 11:21 am
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

Posted: Wed Oct 04, 2006 11:23 am
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).

Posted: Wed Oct 04, 2006 11:32 am
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.

Posted: Wed Oct 04, 2006 11:40 am
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;