3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function __construct( public string $secret, public string $normal ) { //throw new Exception('Error!'); } } class Bar { function __construct( #[\SensitiveParameter] public string $secret, public string $normal ) { //throw new Exception('Error!'); } } try { $foo = new Foo('password', 'normal'); var_dump(serialize($foo)); } catch (Exception $e) { echo $e, PHP_EOL, PHP_EOL; } try { $bar = new Bar('password', 'normal'); var_dump(serialize($bar)); } catch (Exception $e) { echo $e, PHP_EOL, PHP_EOL; }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
160.19 ms | 1681 KiB | 12 Q