3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { $result = array_reduce(range('A', 'E'), function($reduced, $current){ if ($current === 'C') { throw new Exception("Cake!"); } $reduced[] = $current; return $reduced; }); var_dump($result); } catch (Exception $e) { echo "Exception: $e->getMessage()"; }

preferences:
44.6 ms | 402 KiB | 5 Q