1--TEST-- 2Test array_walk() function : usage variations - 'input' argument containing reference variables 3--FILE-- 4<?php 5/* 6 * Testing array_walk() with an array having reference variables 7*/ 8 9echo "*** Testing array_walk() : array with references ***\n"; 10 11$value1 = 10; 12$value2 = -20; 13$value3 = &$value1; 14$value4 = 50; 15 16// 'input' array containing references to above variables 17$input = array(&$value1, &$value2, -35, &$value3, 0, &$value4); 18 19function callback($value, $key) 20{ 21 // dump the arguments to check that they are passed 22 // with proper type 23 var_dump($key); // key 24 var_dump($value); // value 25 echo "\n"; // new line to separate the output between each element 26} 27 28var_dump( array_walk($input, "callback")); 29 30echo "Done" 31?> 32--EXPECT-- 33*** Testing array_walk() : array with references *** 34int(0) 35int(10) 36 37int(1) 38int(-20) 39 40int(2) 41int(-35) 42 43int(3) 44int(10) 45 46int(4) 47int(0) 48 49int(5) 50int(50) 51 52bool(true) 53Done 54