3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array( 'val1', 'val2', 'val3', 'val4', 'val5', ); print_out( $array ); array_walk( $array, function( &$value, $key ) use( &$array ){ $array[ $value ] = array( 'rule' => 'ctype_alnum', ); unset( $array[ $key ] ); }); function print_out( $val ) { echo '<pre>'; var_dump( $val ); echo '</pre>'; } print_out( $array );
Output for 5.3.0 - 5.3.13, 5.4.0 - 5.4.3, 7.1.0RC3 - 7.1.0
<pre>array(5) { [0]=> string(4) "val1" [1]=> string(4) "val2" [2]=> string(4) "val3" [3]=> string(4) "val4" [4]=> string(4) "val5" } </pre> Warning: Illegal offset type in /in/iBhQB on line 10 Warning: Illegal offset type in /in/iBhQB on line 10 Warning: Illegal offset type in /in/iBhQB on line 10 Warning: Illegal offset type in /in/iBhQB on line 10 Warning: Illegal offset type in /in/iBhQB on line 10 <pre>array(0) { } </pre>
Output for 7.0.0 - 7.0.6
<pre>array(5) { [0]=> string(4) "val1" [1]=> string(4) "val2" [2]=> string(4) "val3" [3]=> string(4) "val4" [4]=> string(4) "val5" } </pre>
Process exited with code 139.
Output for hhvm-3.12.0
<pre>array(5) { [0]=> string(4) "val1" [1]=> string(4) "val2" [2]=> string(4) "val3" [3]=> string(4) "val4" [4]=> string(4) "val5" } </pre> Warning: Illegal offset type in /in/iBhQB on line -1 Warning: Illegal offset type in /in/iBhQB on line -1 Warning: Illegal offset type in /in/iBhQB on line -1 Warning: Illegal offset type in /in/iBhQB on line -1 Warning: Illegal offset type in /in/iBhQB on line -1 <pre>array(0) { } </pre>
Output for hhvm-3.10.0
<pre>array(5) { [0]=> string(4) "val1" [1]=> string(4) "val2" [2]=> string(4) "val3" [3]=> string(4) "val4" [4]=> string(4) "val5" } </pre> Warning: Illegal offset type in /in/iBhQB on line 12 Warning: Illegal offset type in /in/iBhQB on line 12 Warning: Illegal offset type in /in/iBhQB on line 12 Warning: Illegal offset type in /in/iBhQB on line 12 Warning: Illegal offset type in /in/iBhQB on line 12 <pre>array(0) { } </pre>
Output for 5.3.14 - 5.3.29, 5.4.4 - 5.6.28
<pre>array(5) { [0]=> string(4) "val1" [1]=> string(4) "val2" [2]=> string(4) "val3" [3]=> string(4) "val4" [4]=> string(4) "val5" } </pre> Warning: Illegal offset type in /in/iBhQB on line 10 <pre>array(4) { [1]=> string(4) "val2" [3]=> string(4) "val4" ["val1"]=> array(1) { ["rule"]=> string(11) "ctype_alnum" } ["val5"]=> array(1) { ["rule"]=> string(11) "ctype_alnum" } } </pre>
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/iBhQB on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/iBhQB on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/iBhQB on line 9
Process exited with code 255.