<?php function byref( &$arg ) { $arg = 'abc'; } function bar($a) { $x = new Exception(); $trace = $x->getTrace(); foreach ( $trace as $frame ) { if ( empty( $frame['args'] ) ) { continue; } foreach ( $frame['args'] as $key => $arg ) { if ( is_array( $arg ) ) { // array_walk_recursive( $arg, 'byref' ); // same issue when doing it manually: foreach ( $arg as &$foo ) { $foo = 'xyz'; } unset( $foo ); } } } } $b = array( 'X', 'Y' ); foreach ( $b as &$value ) { bar( $b ); var_dump( $value ); }
You have javascript disabled. You will not be able to edit any code.