PHP Velho Oeste 2024

ReflectionClass::getStartLine

(PHP 5, PHP 7)

ReflectionClass::getStartLineGets starting line number

설명

public int ReflectionClass::getStartLine ( void )

Get the starting line number.

Warning

이 함수는 현재 문서화 되어있지 않습니다; 인수 목록만을 제공합니다.

인수

이 함수는 인수가 없습니다.

반환값

The starting line number, as an integer.

참고

add a note add a note

User Contributed Notes 1 note

up
0
info at ensostudio dot ru
2 years ago
Note: lines in file start from 1!
Sample to get class code:
<?php
$class
= new ReflectionClass('Foo');
$offset = $class->getStartLine() - 1;
$code = implode(
   
'',
   
array_slice(
       
file($class->getFileName()),
       
$offset,
       
$class->getEndLine() - $offset
   
)
);
?>
To Top