3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '5'; $result = match($input){ 0 => "hello", '1', '2', '0' => "world", default => 'not found' }; echo $result $result = ''; switch ($input) { case 0: $result = "hello"; break; case '1': case '2': case '0': $result = "world"; break; default: $result = "not found"; } echo $result ;
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.24, 7.4.0 - 7.4.12
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /in/ve1i7 on line 6
Process exited with code 255.

preferences:
197.7 ms | 941 KiB | 81 Q