class test{
private $name;
function set($value){
$this->name = $value;
}
function get(){
return $this->name;
}
}
class reflectionUtil{
static function getClassSourse( ReflectionClass $class){
$path = $class->getFileName();
$lines = @file($path);
$from = $class->getStartLine();
$to = $class->getEndLine();
$len = $to-$from+1;
return implode(array_slice($lines, $from-1,$len));
}
}
print ReflectionUtil::getClassSourse( new ReflectionClass('test'));