Yo jugando un poco con reflection
Código PHP:
Ver original<?php
class Test
{
public function method1($name)
{
echo "hola $name";
}
public function method2()
{
try {
$method = 'method1';
$r = new ReflectionClass($this);
$r->getMethod($method)->invoke($this, 'carlos');
} catch(Exception $e) {
echo $e->getMessage();
}
}
}
$a = new Test();
$a->method2();
a lo mejor me regañan por ahí