3v4l.org

run code in 300+ PHP versions simultaneously
<?php function wrap( $arr){ test( $arr); } function test( $arr){ $refs = array(); $f = function( $arr) use( &$refs, &$f) { $refs[] = $arr; foreach( $arr as $v) { if( in_array( $v, $refs)) { print 'ref, '; } else { if( is_array( $v)) { $f( $v); } else { print $v . ', '; } } } } $f( $arr); }
Output for 5.4.0 - 5.4.14
Parse error: syntax error, unexpected '$f' (T_VARIABLE) in /in/licW5 on line 23
Process exited with code 255.
Output for 5.3.0 - 5.3.24
Parse error: syntax error, unexpected T_VARIABLE in /in/licW5 on line 23
Process exited with code 255.

preferences:
178.73 ms | 1395 KiB | 47 Q