Hi:
I had the fallowing trouble while using a static method call on php5. Here's
my solution, i will really apreciate if anyone else can find another way
around..
The problem:
I have a fuction wich get a parameter that's an objetc, and that objetc
belongs to a class wich has a static method ( several class's may have the
same method, that's the reason for i never know for sure wich class the
objetc belongs to...) it has to be call inside the fuction... the solution i
found was:
<?
class Class1 {
static function do_static() { echo 'ok'; }
}
function use_static($object1) {
$class1 = get_class($object1);
$method = new ReflectionMethod($class1, 'do_static');
$method->invoke(null);
// First, I thinks do that
// $class1 = get_class($object1);
// $class1::do_static;
// But, I recieve an error
}
$object1 = new Class1;
use_static($object1);
?>
gretings
Adrian