declaring variables in class definitions
| From: | sam1600 at iname dot com | Date: | Wed, 10 Jan 2001 03:42:58 +0000 |
| Subject: | declaring variables in class definitions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-33623@lists.php.net to get a copy of this message | ||
Hello,
class a {
var $somevar;
function b(){
if (!isset($this->somevar))
echo "Not set<br>";
if (empty($this->somevar))
echo "empty<br>";
}
}
$d = new a;
$d->b();
The above returns:
Not set
empty
What in the world is reason for declaring the following in the class?:
var $somevar;
I see no reason, and no differences if I don't declare: var $somevar;
Maybe a better question is what will break if I do not declare
my vars in my class definition?
Thanks,
Sam
----------------------------------------------------------------
Get your free email from AltaVista at http://altavista.iname.com