3v4l.org

run code in 300+ PHP versions simultaneously
<?php $someArray = ("key1" => "value1", "key2" => "value2", "key3" => "value3", "key4" => "value4"); $len = count($someArray); $i = 0; foreach($someArray AS $key => $value) { if($i == $len - 1) { echo "This is the last line!"; } else { echo "This is line $i\n"; } $i++; }
Output for 5.4.13
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /in/baOrZ on line 2
Process exited with code 255.
Output for 5.4.0 - 5.4.12
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in htr01 on line 2
Process exited with code 255.
Output for 5.3.23
Parse error: syntax error, unexpected T_DOUBLE_ARROW in /in/baOrZ on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.22
Parse error: syntax error, unexpected T_DOUBLE_ARROW in htr01 on line 2
Process exited with code 255.

preferences:
181.56 ms | 1395 KiB | 45 Q