ReflectionClass::getStartLine

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getStartLineObtém o número da linha inicial

Descrição

public ReflectionClass::getStartLine(): int|false

Obtém o número da linha inicial.

Parâmetros

Esta função não possui parâmetros.

Valor Retornado

O número da linha inicial, como um int ou false se desconhecido.

Veja Também

adicione uma nota

Notas Enviadas por Usuários (em inglês) 1 note

up
0
info at ensostudio dot ru
3 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