- var_dump: documentation ( source)
- serialize: documentation ( source)
<?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;
}