Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
<?php class ApiException extends RuntimeException { public function __construct( string $message, int $code, private readonly array $context = [], ?\Throwable $previous = null ) { parent::__construct($message, $code, $previous); } public function getContext(): array { return $this->context; } } throw new ApiException( "Payment declined", 402, [ "user_id" => $user->id, "order_id" => $order->id, "gateway" => "stripe", "amount" => $order->total, ] );
Result
Open