Re: Newbie: why do I get this error?
| From: | Steve Edberg | Date: | Mon, 26 Feb 2001 18:28:33 +0000 |
| Subject: | Re: Newbie: why do I get this error? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41718@lists.php.net to get a copy of this message | ||
At 3:47 PM +0530 2/26/01, Harshdeep S Jawanda wrote:
Hello everybody, I am a newbie, so please help me out with my rather basic question. Please take a look at the following code snippet: class HTMLTable extends HTMLElement {In your HTMLTable() function, use $this->attributes[] = array("border", "0"); $this->attributes[] = array("cellpadding", "0"); otherwise, PHP thinks $attributes is a variable local to that function, rather that a class variable. -stevevar $attributes;function HTMLTable() { $attributes[] = array("border", "0"); $attributes[] = array("cellpadding", "0"); // and some other things }function emit() { // I get an error on this line $arrLength = count($this->attributes[1]); }} On the line indicated above, I get the error: "Warning: Undefined property: attributes in html_base_classes.inc on line <line-number>" Can anybody give me a clue as to why this is happening?
-- Regards, Harshdeep Singh Jawanda.-- +--- "They've got a cherry pie there, that'll kill ya" ------------------+ | Steve Edberg University of California, Davis | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +-------------------------------------- FBI Special Agent Dale Cooper ---+