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
<[EMAIL PROTECTED]>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to