Bug #11142 Updated: '::' for object variables. Static code
| From: | yohgaki@php.net | Date: | Tue, 29 Jan 2002 01:49:07 +0000 |
| Subject: | Bug #11142 Updated: '::' for object variables. Static code | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-78390@lists.php.net to get a copy of this message | ||
ID: 11142
Updated by: yohgaki
Old Summary: '::' for object variables. Static code
Reported By: foobardotcom@poczta.onet.pl
Old Status: Open
Status: Closed
Bug Type: Feature/Change Request
Operating System: all
PHP Version: 4.0.5
New Comment:
Will be in ZE2
Previous Comments:
------------------------------------------------------------------------
[2001-05-27 14:39:51] foobardotcom@poczta.onet.pl
I just want, you make this code possible:
<?php
class foo {
var $bar = "dot";
}
echo foo::bar;
?>
============================================================
Second request is about static code part in class declaration. It is
because 'var' statement doesn't support function results. There is way
for omit this problem -- do it using constructor.
There is one problem. If I want to use it by '::' operator, I must use
constructor before using this class... and there are so many problems
with it.
My proposition is that:
<?php
class foo {
static {
$conn = pg_connect("dbname=example");
}
function getConnection() {
return $this->conn;
}
}
$globalConn = foo::getConnection();
// ...
?>
Meaning of that is just request for operations on classes, not on
instances only.
Static part of class declaration is very usefull. In that code you can
e.g. place other constructions -- for() or while().
I believe in you!
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=11142&edit=1