Question: I'm new to the OOP paradigm, so there's probably a simple explanation for this question...

Do you always need to declare public object-wide variables in a class? For example:

```
<?php

class TestClass
{
    var $declaredVar;

    function __construct()
    {
        $this->declaredVar = "I am a declared variable.";
        $this->undeclaredVar = "I wasn't declared, but I still work.";
    }

    function display()
    {
        echo $this->declaredVar . "<br />";
        echo $this->undeclaredVar;
        echo "<br /><br />"; 
    }
}

$test = new TestClass;
$test->display();

$test->declaredVar = "The declared variable was changed.";
$test->undeclaredVar = "The undeclared variable was changed.";

$test->display();

?>

```

In this code, even though `$declaredVar` is the only declared variable, `$undeclaredVar` is just as accessible and useable--it seems to act as if I had declared it as public. 

If undeclared class variables are always accessible like that, what's the point of declaring them all up front?

Answer: 
If you declare a member inside the class you can set its accessibility e.g

```
private $varname;

```
In general variables should be initialized as soon as you have enough info to do it properly.

If a class variable needs certain info to be sensibly initialized then that info should be passed to the constructor.

Using PHP's syntax to implicitly declare variables at the point of definition is, IMHO a surefire way to introduce bugs - if your class needs a variable then declare it, and use all of the information hiding that OOP affords you.