atom feed2 messages in com.googlegroups.professional-phpRe: PHP __construct method and arguments
FromSent OnAttachments
sali...@gmail.comDec 3, 2007 1:40 pm 
sali...@gmail.comDec 4, 2007 1:57 am 
Subject:Re: PHP __construct method and arguments (
Date:Dec 4, 2007 1:57:23 am

Thanks a lot, that's what I'll do !!

On Dec 4, 10:35 am, "Sarel van der Walt" <> wrote:

Yes, it sure is. I've used it once to construct an Object from a row in the Database where I pass it the ID of the record and it retrieved the data on creation of the object. Just remember, it's best practice to use defaults like __construct($myValue = null) and in your code some check like if ($myValue == nulle) {//then take care if that}


-----Original Message----- From:

[] On Behalf Of Sent: 03 December 2007 11:40 PM To: Professional PHP Developers Subject: [Pro. PHP Dev.] PHP __construct method and arguments

H everybody,

Is it possible to pass arguments throw the constructor of a PHP class , as the following example shows it ?

private $myClassParameter;

public function __construct($myValue) { $myClassParameter = $myValue; }