ID: 11142
Updated by: yohgaki
Old Summary: '::' for object variables. Static code
Reported By: [EMAIL PROTECTED]
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] [EMAIL PROTECTED]

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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to