1--TEST-- 2Test ReflectionFunction::getClosure() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : public mixed ReflectionFunction::getClosure() 6 * Description: Returns a dynamically created closure for the function 7 * Source code: ext/reflection/php_reflection.c 8 * Alias to functions: 9 */ 10 11echo "*** Testing ReflectionFunction::getClosure() : basic functionality ***\n"; 12 13function foo() 14{ 15 var_dump( "Inside foo function" ); 16} 17 18function bar( $arg ) 19{ 20 var_dump( "Arg is " . $arg ); 21} 22 23$func = new ReflectionFunction( 'foo' ); 24$closure = $func->getClosure(); 25$closure(); 26 27$func = new ReflectionFunction( 'bar' ); 28$closure = $func->getClosure(); 29$closure( 'succeeded' ); 30 31?> 32===DONE=== 33--EXPECTF-- 34*** Testing ReflectionFunction::getClosure() : basic functionality *** 35string(19) "Inside foo function" 36string(16) "Arg is succeeded" 37===DONE=== 38