3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types = 1); class HelloWorld { public function __construct(private readonly string $secret, private readonly string $notSecret) { throw new \Exception('a'); } } class Bar extends HelloWorld { public function __construct(#[\SensitiveParameter] string $secret, string $notSecret) { parent::__construct($secret, $notSecret); } } echo serialize(new Bar('foo', 'bar')) . PHP_EOL;
Output for 8.1.0 - 8.1.34
Fatal error: Uncaught Exception: a in /in/KZWmp:6 Stack trace: #0 /in/KZWmp(12): HelloWorld->__construct('foo', 'bar') #1 /in/KZWmp(16): Bar->__construct('foo', 'bar') #2 {main} thrown in /in/KZWmp on line 6
Process exited with code 255.
Output for 8.2.0 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
Fatal error: Uncaught Exception: a in /in/KZWmp:6 Stack trace: #0 /in/KZWmp(12): HelloWorld->__construct('foo', 'bar') #1 /in/KZWmp(16): Bar->__construct(Object(SensitiveParameterValue), 'bar') #2 {main} thrown in /in/KZWmp on line 6
Process exited with code 255.

preferences:
30.36 ms | 1155 KiB | 9 Q