Having a little trouble with this static 'inheritance' in php 5.3 I need to test if a static function exists in static class but I need to test it from inside a parent static class.
I know in php 5.3 I can use the 'static' keyword to sort of simulate 'this' keyword. I just can't find a way to test if function exists.
İşte bir örnek:
// parent class
class A{
// class B will be extending it and may or may not have
// static function name 'func'
// i need to test for it
public static function parse(array $a){
if(function_exists(array(static, 'func'){
static::func($a);
}
}
}
class B extends A {
public static function func( array $a ){
// does something
}
}
So now I need to execute B::parse();
the idea is that if subclass has a function, it will be used,
otherwise it will not be used.
Denedim:
function_exists(static::func){}
isset(static::func){}
Bu 2 çalışmıyor.
Any ideas how to do this? By the way, I know about the possibility to passing a lambda function as a workaround, this is not an option in my situation.
Ben sadece şu an düşünemiyorum çok basit bir çözüm var bir his var.
Şimdi aramak gerekiyor