3v4l.org

run code in 300+ PHP versions simultaneously
<?php $callable = fn() => throw new Exception(); // $value is non-nullable. // $value = $nullableValue ?? throw new InvalidArgumentException(); // $value is truthy. $value = $falsableValue ?: throw new InvalidArgumentException(); // $value is only set if the array is not empty. $value = !empty($array) ? reset($array) : throw new InvalidArgumentException();

preferences:
49.1 ms | 402 KiB | 5 Q