3v4l.org

run code in 300+ PHP versions simultaneously
<?php function three() { throw new RuntimeException('first exception'); } function two() { try { three(); } catch (Throwable $e) { throw new CustomException('custom', previous: $e); } } function one() { two(); } class CustomException extends Exception { public function getFullTrace() { return $this->getPrevious()?->getTrace() ?? $this->getTrace(); } } try { one(); } catch (CustomException $e) { var_dump($e->getFullTrace()); }

preferences:
27.51 ms | 404 KiB | 5 Q