note 108048 deleted from function.set-error-handler by danbrown

From: Date: Tue, 27 Mar 2012 15:38:53 +0000
Subject: note 108048 deleted from function.set-error-handler by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186865@lists.php.net to get a copy of this message
Note Submitter: qfox at ya dot ru ---- Alexey. <?php set_error_handler(array(Debug,'test')); ?> Static function accepted by set_error_handler() and works but php generates E_NOTICE "Use of undefined constant Debug" Yes, because if you need static call you must describe it correctly. Actually what is PHP did is convert Debug (undefined constant) to "Debug" string. So the correct solution is: <?php set_error_handler(array('Debug','test')); ?> Afaik it must work in php since 5.3 or 5.4 version: <?php set_error_handler('Debug::test'); ?> Because of closure type. You can see a lot of examples how it works at page http://ru.php.net/manual/en/function.is-callable.php

« previous php.notes (#186865) next »