note 103699 modified in reflection.extending by danbrown

From: Date: Thu, 28 Apr 2011 18:29:51 +0000
Subject: note 103699 modified in reflection.extending by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179245@lists.php.net to get a copy of this message
Extending class ReflectionFunction to get source code of function <?php class Custom_Reflection_Function extends ReflectionFunction { public function getSource() { if( !file_exists( $this->getFileName() ) ) return false; $start_offset = ( $this->getStartLine() - 1 ); $end_offset = ( $this->getEndLine() - $this->getStartLine() ) + 1; return join( '', array_slice( file( $this->getFileName() ), $start_offset, $end_offset ) ); } } ?> --was-- Extending class ReflectionFunction to get source code of function class Custom_Reflection_Function extends ReflectionFunction { public function getSource() { if( !file_exists( $this->getFileName() ) ) return false; $start_offset = ( $this->getStartLine() - 1 ); $end_offset = ( $this->getEndLine() - $this->getStartLine() ) + 1; return join( '', array_slice( file( $this->getFileName() ), $start_offset, $end_offset ) ); } } http://php.net/manual/en/reflection.extending.php

« previous php.notes (#179245) next »