1--TEST-- 2ReflectionFunction methods 3--CREDITS-- 4Robin Fernandes <robinf@php.net> 5Steve Seear <stevseea@php.net> 6--FILE-- 7<?php 8 9/** 10 * my doc comment 11 */ 12function foo () { 13 static $c; 14 static $a = 1; 15 static $b = "hello"; 16 $d = 5; 17} 18 19/*** 20 * not a doc comment 21 */ 22function bar () {} 23 24 25function dumpFuncInfo($name) { 26 $funcInfo = new ReflectionFunction($name); 27 var_dump($funcInfo->getName()); 28 var_dump($funcInfo->isInternal()); 29 var_dump($funcInfo->isUserDefined()); 30 var_dump($funcInfo->getStartLine()); 31 var_dump($funcInfo->getEndLine()); 32 var_dump($funcInfo->getStaticVariables()); 33} 34 35dumpFuncInfo('foo'); 36dumpFuncInfo('bar'); 37dumpFuncInfo('extract'); 38 39?> 40--EXPECT-- 41string(3) "foo" 42bool(false) 43bool(true) 44int(6) 45int(11) 46array(3) { 47 ["c"]=> 48 NULL 49 ["a"]=> 50 int(1) 51 ["b"]=> 52 string(5) "hello" 53} 54string(3) "bar" 55bool(false) 56bool(true) 57int(16) 58int(16) 59array(0) { 60} 61string(7) "extract" 62bool(true) 63bool(false) 64bool(false) 65bool(false) 66array(0) { 67} 68