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