Re: New exceptions mechanism
| From: | Ferdinand Beyer | Date: | Wed, 04 Feb 2004 06:16:00 +0000 |
| Subject: | Re: New exceptions mechanism | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-7528@lists.php.net to get a copy of this message | ||
On 3 Feb 2004 at 21:54, Adam Bregenzer wrote:
> Is there a plan to
> implement static variables in php5?
--- Quote from ZEND_CHANGES ---
* Member variables of classes can now be initialized.
Example:
<?php
class foo {
static $my_static = 5;
public $my_prop = 'bla';
}
print foo::$my_static;
$obj = foo;
print $obj->my_prop;
?>
* Static Methods.
The Zend Engine 2.0 introduces the 'static' keyword to declare
a method static, thus callable from outside the object context.
Example:
<?php
class Foo {
public static function aStaticMethod() {
// ...
}
}
Foo::aStaticMethod();
?>
The pseudo variable $this is not available inside a method that
has been declared static.
---------------------------------------------------
--
Ferdinand Beyer
<fb@fbeyer.com>