1--TEST--
2Test array_map() function : usage variations - callback pass semantics
3--FILE--
4<?php
5/* Prototype  : array array_map  ( callback $callback  , array $arr1  [, array $...  ] )
6 * Description: Applies the callback to the elements of the given arrays
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Test array_map() with a pass-by-value callback forced to behave as a pass-by-reference function.
12 */
13
14$arr1 = array('original.0', 'original.1');
15$arr2 = array('original.0', 'original.1');
16
17function callback($a) {
18   $a = "changed";
19}
20
21array_map('callback', $arr1);
22var_dump($arr1);
23
24$ref  =& $arr2[0];
25array_map("callback", $arr2);
26var_dump($arr2);
27?>
28--EXPECTF--
29array(2) {
30  [0]=>
31  string(10) "original.0"
32  [1]=>
33  string(10) "original.1"
34}
35array(2) {
36  [0]=>
37  &string(10) "original.0"
38  [1]=>
39  string(10) "original.1"
40}