PHP 8.6.0 Beta 1 is available for testing

ReflectionClass::getStartLine

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getStartLineObtiene el número de línea de inicio

Descripción

public function ReflectionClass::getStartLine(): int |false

Obtiene el número de línea de inicio.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

El número de línea de inicio, como int , o false si es desconocido.

Véase también

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes 1 note

up
0
info at ensostudio dot ru
4 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
 )
);
?>
+add a note

AltStyle によって変換されたページ (->オリジナル) /