3v4l.org

run code in 300+ PHP versions simultaneously
<?php $operations = [ '+' => "add", '-' => "subtract" ]; // The numbers $n1 = 6; $n2 = 3; // Your operation $op = "+"; switch($operations[$op]) { case "add": // add the nos echo $n1 + $n2; break; case "subtract": // subtract the nos echo $n1 - $n2; break; default: // we can't handle other operators throw new RuntimeException(); break; }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
213.41 ms | 2058 KiB | 8 Q