# PHP Error Reporting Question

**URL:** <https://forum.kirupa.com/t/php-error-reporting-question/158361>\
**Category:** programming\
**Created:** [August 9, 2005, 10:22am UTC](https://forum.kirupa.com/t/php-error-reporting-question/158361 "2005-08-09T10:22:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icio](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/icio/32/484_2.png) [@icio](https://forum.kirupa.com/u/icio)\
**Post date:** [August 9, 2005, 10:22am UTC](https://forum.kirupa.com/t/php-error-reporting-question/158361/1 "2005-08-09T10:22:35Z")

</div>

I’m just testing a little script for classes, having had a little problem with another i’m trying to figure it out using this.

here is my code:

```php
<?

class testClass {
    var $public_var;
    function testClass() {
        $this->$public_var = "theAssignedValue";
        $this->test();
    }
    function test() {
	echo(isset($this->$public_var)==true?"yes":"no");
        echo($this->$public_var);
    }
}

$myClass = new testClass();

?>

```

when i open that from my server, i get this output:

```auto

Notice: Undefined variable: public_var in C:\Program Files\Apache Group\Apache2\htdocs\class test.php on line 6

Notice: Undefined variable: public_var in C:\Program Files\Apache Group\Apache2\htdocs\class test.php on line 10
yes
Notice: Undefined variable: public_var in C:\Program Files\Apache Group\Apache2\htdocs\class test.php on line 11
theAssignedValue

```

If it works, why am i getting these errors ?

I am aware that changing the level of error that php warns for would help, but I would also like to know why it is an error in the first place.

Thank you for any insight you may provide.
