Bug #16479 Updated: var declaration in class has no meaning?

From: Date: Mon, 08 Apr 2002 19:49:13 +0000
Subject: Bug #16479 Updated: var declaration in class has no meaning?
References: 1  Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-4367@lists.php.net to get a copy of this message
ID: 16479 Updated by: vdhome@idas.cz Reported By: vdhome@idas.cz Status: Open Bug Type: Documentation problem Operating System: Win98SE PHP Version: 4.0.6 New Comment: Yeah, I guess I asked for it. But then I'd have to argue that the var declaration itself is against the nature of PHP! Firstly because it's a declaration, and secondly because it's useless. Anyway, I understand that there will be major changes in OOP in ZendEngine2, so this is probably not relevant anymore. BTW, when is this ZE2 scheduled to launch? Will it be already in 4.2.0 which is now in RC stage? Previous Comments: ------------------------------------------------------------------------ [2002-04-08 01:29:14] mfischer@php.net Well, you have get_class_vars() which can retrieve all the default properties (i.e. the ones declared with 'var $foo'). And your last suggestions is against the nature of PHP. You just do not have to declare variables to use it. Making this a doc problem though I'm not quite sure; letting the doc team decide. ------------------------------------------------------------------------ [2002-04-07 18:31:55] vdhome@idas.cz I am not sure whether this is a bug, a feature, or lack of a feature. Perhaps this should be marked a "Feature Request" then... Anyway, here goes: the var declaration in a class seems to have no meaning whatsoever, except perhaps for documentation purposes. PHP allows me to assign to class variables that weren't declared without even a warning at the highest warning reporting level. That's actually not very surprising since PHP doesn't otherwise have declarations of variables, but what is then the meaning of var in classes? I suggest that PHP should at least warn about class variables that weren't declared. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16479&edit=1

« previous php.bugs (#4367) next »