Reply to Re: __contruct in php4 not same behavior as php5

Your name:

Reply:


Posted by FFMG on 11/22/07 05:49

Oliver Grδtz;104701 Wrote:
> FFMG schrieb:
> > I am slowly moving my code to php5.
>
> Hurry up! http://gophp5.org/
>

Last I checked this is still my server :)
I will move to php5 when my code is ready. I should make it in time in
any case.

Oliver Grδtz;104701 Wrote:
> FFMG schrieb:
> [color=blue]
> > But I would like to make it backward compatible in case something
> bad
> > happens, (and to make sure I understand what the changes are).
> >
> > function TestClass() // For php4
> > {
> > $this->__construct();
> > }
>
> Very. Bad. Idea. Do not touch the PHP4 style constructors until you
> finally stop supporting PHP4 in your application. Plan on doing this
> QUICKLY! PHP4 dies! You had three and a half years time to switch to
> PHP5...
>
> You will see the reference vs. copy issue explained by Rik Wasmus
> everywhere in your application. PHP5 defaults to giving you references
> instead of copies and the once almost-always-needed & operators left
> over from your PHP4 code will in fact lead to a higher memory
> consumption than necessary under PHP5 caused by the details in the
> memory management of the Zend Engine but besides that your programm
> will
> still run fine.
>
> OLLi
>

Well, according to
http://www.php.net/manual/en/language.oop5.decon.php,

"For backwards compatibility, if PHP 5 cannot find a __construct()
function for a given class, it will search for the old-style
constructor function, by the name of the class."

In other words, the way I read this,

> function TestClass() // For php4
> {
> $this->__construct();
> ...

will never be called in php5 because __construct() exists, so it is
truly for backward compatibility.

FFMG


--

'webmaster forum' (http://www.httppoint.com) | 'Free Blogs'
(http://www.journalhome.com/) | 'webmaster Directory'
(http://www.webhostshunter.com/)
'Recreation Vehicle insurance'
(http://www.insurance-owl.com/other/car_rec.php) | 'Free URL
redirection service' (http://urlkick.com/)
------------------------------------------------------------------------
FFMG's Profile: http://www.httppoint.com/member.php?userid=580
View this thread: http://www.httppoint.com/showthread.php?t=22378

Message Posted via the webmaster forum http://www.httppoint.com, (Ad revenue sharing).

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация