1--TEST-- 2Indirect function calls 3--FILE-- 4<?php 5 6function id($x = 'id') { return $x; } 7 8var_dump(0); 9 10id('var_dump')(1); 11id('id')('var_dump')(2); 12id('id')('id')('var_dump')(3); 13id()()('var_dump')(4); 14 15id(['udef', 'id'])[1]()('var_dump')(5); 16(id((object) ['a' => 'id', 'b' => 'udef'])->a)()()()()('var_dump')(6); 17 18$id = function($x) { return $x; }; 19 20$id($id)('var_dump')(7); 21 22(function($x) { return $x; })('id')('var_dump')(8); 23 24($f = function($x = null) use (&$f) { 25 return $x ?: $f; 26})()()()('var_dump')(9); 27 28class Test { 29 public static function id($x = [__CLASS__, 'id']) { return $x; } 30} 31 32$obj = new Test; 33[$obj, 'id']()('id')($id)('var_dump')(10); 34['Test', 'id']()()('var_dump')(11); 35'id'()('id')('var_dump')(12); 36('i' . 'd')()('var_dump')(13); 37'\id'('var_dump')(14); 38 39?> 40--EXPECT-- 41int(0) 42int(1) 43int(2) 44int(3) 45int(4) 46int(5) 47int(6) 48int(7) 49int(8) 50int(9) 51int(10) 52int(11) 53int(12) 54int(13) 55int(14) 56