is there any setting to declare the member variables in constructor?

From: Date: Sat, 27 Mar 2010 16:50:21 +0000
Subject: is there any setting to declare the member variables in constructor?
Groups: php.general 
Request: Send a blank email to php-general+get-303525@lists.php.net to get a copy of this message
now i'm re-writing some script to output pdf files. the original code is based on fpdf, but as you know, fpdf can't deal with the characters in utf8. so i want to change it to tcpdf. there is a class extend from fpdf, in its constructor function, there is some script just like "$this->db = $db;". there isn't any variable named "$db" in parent class(class fpdf) and child class, i have checked it carefully and "print_r($this)" at the top of child's constructor function. but after "$this->db=$db", there is a member variable named $db(i have print_r and check it too). when i change the parent class to tcpdf, although i haven't change any code in child class and there isn't a member variable named $db in parent class(class tcpdf), php returns me a error "TCPDF ERROR: Cannot access protected property / Undefined property". i print_r($this) at the top of constructor function again and check whether there is a member variable named $db in both parent and child class, finally i'm sure there isn't. i think maybe there is a setting in the parent class(fpdf/tcpdf) here about this condition. it controls whether you can declare a member variable by equaling it. i tried to find it out on google or in fpdf/tcpdf sources but i failed, there are about 16k lines in tcpdf.... so i post this mail to request some help, is there somebody have any experience about this case? please help me, thanks a lot. solo

« previous php.general (#303525) next »