note 97740 modified in language.oop5.paamayim-nekudotayim by danbrown
| From: | danbrown@php.net | Date: | Wed, 05 May 2010 21:14:54 +0000 |
| Subject: | note 97740 modified in language.oop5.paamayim-nekudotayim by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168989@lists.php.net to get a copy of this message | ||
As of php 5.3.0, you can use 'static' as scope value as in below example (add flexibility
to inheritance mechanism compared to 'self' keyword...)
<?php
class A {
const C = 'constA';
public function m() {
echo static::C;
}
}
class B extends A {
const C = 'constB';
}
$b = new B();
$b->m();
// output: constB
?>
--was--
As of php 5.3.0, you can use 'static' as scope value as in below example (add flexibility
to inheritance mechanism compared to 'self' keyword...)
<?php
class A {
const C = 'constA';
public function m() {
echo static::C;
}
}
class B extends A {
const C = 'constB';
}
$b = new B();
$b->m();
// output: constB
http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php