3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); class OrderFill { public function __construct( public float $timestampms, public string $size, public string $price, public ?string $amount = NULL, public string $fee_usd, public string $exchangeOrderId, public string $tradeId, ) { var_dump($amount); } } new OrderFill( timestampms: 1.0, size: "1", price: "1", fee_usd: "1", exchangeOrderId: "1", tradeId: "1", );
Output for 8.1.23 - 8.1.27, 8.2.10 - 8.2.17, 8.3.0 - 8.3.4
Deprecated: Optional parameter $amount declared before required parameter $tradeId is implicitly treated as a required parameter in /in/MOecm on line 4 Fatal error: Uncaught ArgumentCountError: OrderFill::__construct(): Argument #4 ($amount) not passed in /in/MOecm:4 Stack trace: #0 /in/MOecm(24): OrderFill->__construct(1.0, '1', '1', NULL, '1', '1', '1') #1 {main} thrown in /in/MOecm on line 4
Process exited with code 255.
Output for 8.0.0 - 8.0.3
NULL
Output for 7.3.0 - 7.3.28, 7.4.0 - 7.4.16
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting variable (T_VARIABLE) in /in/MOecm on line 5
Process exited with code 255.

preferences:
87.35 ms | 401 KiB | 73 Q