File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / general_functions / call_user_func_return.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
call_user_func() and return value
--FILE--
<?php

$t1 = 'test1';

function test1($arg1, $arg2)
{
	global $t1;
	echo "$arg1 $arg2\n";
	return $t1;
}

$t2 = 'test2';

function & test2($arg1, $arg2)
{
	global $t2;
	echo "$arg1 $arg2\n";
	return $t2;
}

function test($func)
{
	debug_zval_dump($func('Direct', 'Call'));
	debug_zval_dump(call_user_func_array($func, array('User', 'Func')));
}

test('test1');
test('test2');

?>
===DONE===
--EXPECTF--
Direct Call
string(5) "test1" refcount(1)
User Func
string(5) "test1" refcount(1)
Direct Call
string(5) "test2" refcount(2)
User Func
string(5) "test2" refcount(1)
===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>