1--TEST-- 2Test array_walk_recursive() function : object functionality 3--FILE-- 4<?php 5/* Passing object in place of an 'input' argument to test object functionality 6 */ 7echo "*** Testing array_walk_recursive() : object functionality ***\n"; 8 9function callback($value, $key, $user_data) 10{ 11 var_dump($key); 12 var_dump($value); 13 var_dump($user_data); 14 echo "\n"; 15} 16 17class MyClass 18{ 19 private $pri_value; 20 public $pub_value; 21 protected $pro_value; 22 public function __construct($setVal) 23 { 24 $this->pri_value = $setVal; 25 $this->pub_value = $setVal; 26 $this->pro_value = $setVal; 27 } 28}; 29 30// object for 'input' argument 31$input = new MyClass(10); 32 33var_dump( array_walk_recursive($input, "callback", 1)); 34 35echo "Done" 36?> 37--EXPECTF-- 38*** Testing array_walk_recursive() : object functionality *** 39string(18) "%r\0%rMyClass%r\0%rpri_value" 40int(10) 41int(1) 42 43string(9) "pub_value" 44int(10) 45int(1) 46 47string(12) "%r\0%r*%r\0%rpro_value" 48int(10) 49int(1) 50 51bool(true) 52Done 53