Re: Class constructor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, January 31, 2006 7:46 am, Georgi Ivanov wrote:
> I'm writing a simple class. In order to be compatible with php4 and
> php5 I've
> done this :
>
> class test{
> 	function Test(){
> 		//This will be called in PHP4
> 	}
> 	function __construct(){
> 		//This will be called in PHP5
> 		$this->Test();
> 	}
> }
>
> Is this a solution ? Is there a better way ?

I suppose if you want the code to run under PHP6, 7, 8, 9, 10, ... it
is somewhat forward-looking to the potential day when Test::Test()
might no longer work as the constructor...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux