note 107575 deleted from language.oop5.paamayim-nekudotayim by danbrown

From: Date: Thu, 10 May 2012 20:42:36 +0000
Subject: note 107575 deleted from language.oop5.paamayim-nekudotayim by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187827@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- Regarding [phil at philfreo dot com 19-Aug-2010 10:00]; you can use the builtin call_user_func() function to get your desired result (rewriting your second set of code lines will work like this): <?php class Foo { protected $log; public function __construct($logClass = 'MyLog') { $this->log = $logClass; call_user_func(array($this->log, 'write')); // NO LONGER breaks -- works! } } class MyLog { public function write() { echo "writing from MyLog ..."; } } $foo = new Foo(); // => outputs "writing from MyLog ..." ?>

« previous php.notes (#187827) next »