Re: Confused About Classes
| From: | Cirstoiu Aurel Sorin | Date: | Mon, 25 Mar 2002 16:22:18 +0000 |
| Subject: | Re: Confused About Classes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90040@lists.php.net to get a copy of this message | ||
I am sorry but your code works just fine.
What server do you have?And what configuration?
--
-----------------------------------
Cirstoiu Aurel Sorin
Interakt Online Support
http://www.interakt.ro/
"Arti" <bpoff@artechnology.com> wrote in message
news:20020325153300.98575.qmail@pb1.pair.com...
> I am getting the error "Undefined variable this" in my class. I am new to
> PHP and presume I am just doing something wrong. But, I don't understand
> what it could be as the code looks straightforward to me. Note that I
> trimmed out some code to keep this listing from being huge, but the
relevant
> pieces are included.
>
>
> <?php
>
> class standardquestion
> {
>
> var $private;
>
> function standardquestion($xmlfilename)
> {
>
> $this->private=FALSE;
>
> $parser=xml_parser_create();
>
> xml_set_element_handler($parser,
> array("standardquestion","startElementHandler"),
> array("standardquestion","endElementHandler"));
>
> while ($data = fread($fp, 4096))
> {
> if (!xml_parse($parser, $data, feof($fp)))
> {
> die(sprintf("XML error %d %d",
> xml_get_currentnode_line_number($parser),
> xml_get_currentnode_column_number($parser)));
> }
> }
> }
>
> function startElementHandler($parser, $name, $attribs)
> {
> if ($name=="private")
> $this->private = TRUE;
>
> if ($this->private==FALSE) // <<<<-------- Undefined variable
this
> return;
> }
>
>
> function endElementHandler($parser, $name)
> {
> }
>
>
> }
> ?>
>
>
>