- is_callable: documentation ( source)
- method_exists: documentation ( source)
<?php
class test1
{
public function __call( $_method, $_args )
{
echo get_class( $this );
echo method_exists( $this, $_method );
echo is_callable( array( $this, $_method ) );
// $this->lala();
die('g');
if ( method_exists( $this, $_method ) && is_callable( array( $this, $_method ) ) )
{
$res = call_user_func_array( array( $this, $_method ), $_args );
if ( !is_null( $res ) ) return $res;
if ( $this->prev_ ) return call_user_func_array( array( $this->prev_, $_method ), $_args );//return $this->defaultLocale( $_args );
}
else
{
throw new Exception( "Invalid method: " . $_method );
}
}
}
class test2 extends test1
{
private function lala()
{
}
}
$t = new test2();
$t->lala();
?>