note 112028 added to language.oop5.overloading
| From: | PeterOlds | Date: | Wed, 24 Apr 2013 07:49:40 +0000 |
| Subject: | note 112028 added to language.oop5.overloading | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194610@lists.php.net to get a copy of this message | ||
Not that this is a wise idea but I learned you can use the magic function __callStatic to chain into
other classes as demonstrated below:
<?php
class ClassOne {
public static function functionOne() {
echo 'classOne::functionOne()';
}
public static function __callStatic( $name, $arguments = array() ) {
ClassTwo::$name( $arguments );
}
}
class ClassTwo {
public static function functionTwo() {
echo 'classTwo::functionTwo()';
}
public static function __callStatic( $name, $arguments = array() ) {
ClassThree::$name( $arguments );
}
}
class ClassThree
{
public static function functionThree() {
echo 'ClassThree::FunctionThree()';
}
}
ClassOne::functionOne();
ClassOne::functionTwo();
ClassOne::functionThree();
?>
----
Server IP: 69.147.83.199
Probable Submitter: 174.126.43.156
----
Manual Page -- http://php.net/manual/en/language.oop5.overloading.php
Edit -- https://master.php.net/note/edit/112028
Del: integrated -- https://master.php.net/note/delete/112028/integrated
Del: useless -- https://master.php.net/note/delete/112028/useless
Del: bad code -- https://master.php.net/note/delete/112028/bad+code
Del: spam -- https://master.php.net/note/delete/112028/spam
Del: non-english -- https://master.php.net/note/delete/112028/non-english
Del: in docs -- https://master.php.net/note/delete/112028/in+docs
Del: other reasons-- https://master.php.net/note/delete/112028
Reject -- https://master.php.net/note/reject/112028
Search -- https://master.php.net/manage/user-notes.php