note 58437 added to language.oop5.static

From: Date: Fri, 04 Nov 2005 09:17:05 +0000
Subject: note 58437 added to language.oop5.static
Groups: php.notes 
Request: Send a blank email to php-notes+get-98055@lists.php.net to get a copy of this message
Here is my solution to the static search method problem for data objects. I found the debug_trace version posted earlier quite clever, but a little too risky. <?php class Foo { static function find($class) { $obj = new $class(); return $obj; } } class Bar extends Foo { static function find() { return parent::find(__CLASS__); } function print_hello() { echo("hello"); } } Bar::find()->print_hello(); ?> ---- Manual Page -- http://www.php.net/manual/en/language.oop5.static.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58437 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58437&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58437&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58437&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58437&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58437&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58437&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58437&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58437&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98055) next »