note 88664 added to function.is-callable

From: Date: Mon, 02 Feb 2009 20:12:54 +0000
Subject: note 88664 added to function.is-callable
Groups: php.notes 
Request: Send a blank email to php-notes+get-150124@lists.php.net to get a copy of this message
/** * The is_callable php function only considers methods declared in the class itself, and ignores the parent's. * This version considers all of the hierarchy. * * @param (string|Object) $class_name * @param string $method_name */ function isCallable( $class_name, $method_name ){ // Check class itself if( is_callable( array( $parent_class, $method_name ) ) ){ return true; } // Check all parents while( $parent_class = get_parent_class( $class_name ) ){ if( is_callable( array( $parent_class, $method_name ) ) ){ return true; } $class_name = $parent_class; } return false; } ---- Server IP: 216.235.13.26 Probable Submitter: 96.49.181.214 ---- Manual Page -- http://www.php.net/manual/en/function.is-callable.php Edit -- https://master.php.net/note/edit/88664 Del: integrated -- https://master.php.net/note/delete/88664/integrated Del: useless -- https://master.php.net/note/delete/88664/useless Del: bad code -- https://master.php.net/note/delete/88664/bad+code Del: spam -- https://master.php.net/note/delete/88664/spam Del: non-english -- https://master.php.net/note/delete/88664/non-english Del: in docs -- https://master.php.net/note/delete/88664/in+docs Del: other reasons-- https://master.php.net/note/delete/88664 Reject -- https://master.php.net/note/reject/88664 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#150124) next »