Re: redefined constructor: old and new syntax

From: Date: Thu, 18 Mar 2004 08:59:40 +0000
Subject: Re: redefined constructor: old and new syntax
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-8576@lists.php.net to get a copy of this message
Why would anyone need this? if __construct() contains php5-only syntax, it won't work anyway on php4. If it contains something that works in php4 - why do you need separate constructor? Anyway, since in no place besides constructor you can not do such tricks - why constructors should be the only place in the language where such tricks are used? What's so special in them? AG>> > >> class MyClass AG>> > >> { AG>> > >> function MyClass() { AG>> > >> //constructor for php4, AG>> > >> //SHOULD be ignored by php5 AG>> > >> } AG>> > >> AG>> > >> function __construct() { AG>> > >> //constructor for php5, AG>> > >> //ignored by php4 AG>> > >> } AG>> > >> } AG>> > >> AG>> > >> AG>> > >> i.e. it doesn't allow a class to work on both php4 and php5. Or AG>> > >> am I missing something obvious? -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.109

« previous php.internals (#8576) next »