Return to bug34982.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Bug #34982 (array_walk_recursive() modifies elements outside function scope) 3: --FILE-- 4: <?php 5: $ar = array( 6: 'element 1', 7: array('subelement1') 8: ); 9: 10: func($ar); 11: print_r($ar); 12: 13: function func($a) { 14: array_walk_recursive($a, 'apply'); 15: print_r($a); 16: } 17: 18: function apply(&$input, $key) { 19: $input = 'changed'; 20: } 21: ?> 22: --EXPECT-- 23: Array 24: ( 25: [0] => changed 26: [1] => Array 27: ( 28: [0] => changed 29: ) 30: 31: ) 32: Array 33: ( 34: [0] => element 1 35: [1] => Array 36: ( 37: [0] => subelement1 38: ) 39: 40: )