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; }
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.13
string(68) "O:3:"Foo":2:{s:6:"secret";s:8:"password";s:6:"normal";s:6:"normal";}" string(68) "O:3:"Bar":2:{s:6:"secret";s:8:"password";s:6:"normal";s:6:"normal";}"

preferences:
71.19 ms | 406 KiB | 5 Q