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 ){ $value = array( 'value' => $value, 'rule' => 'ctype_alnum', ); }); function print_out( $val ) { echo '<pre>'; var_dump( $val ); echo '</pre>'; } print_out( $array );
Output for 5.3.0 - 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><pre>array(5) { [0]=> array(2) { ["value"]=> string(4) "val1" ["rule"]=> string(11) "ctype_alnum" } [1]=> array(2) { ["value"]=> string(4) "val2" ["rule"]=> string(11) "ctype_alnum" } [2]=> array(2) { ["value"]=> string(4) "val3" ["rule"]=> string(11) "ctype_alnum" } [3]=> array(2) { ["value"]=> string(4) "val4" ["rule"]=> string(11) "ctype_alnum" } [4]=> array(2) { ["value"]=> string(4) "val5" ["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/doAka 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/doAka on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/doAka on line 9
Process exited with code 255.