3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Secured { public function __construct( private readonly \SensitiveParameterValue $content ) { } public static function fromString( #[\SensitiveParameter] string $value, ) { return new self(new \SensitiveParameterValue($value)); } public function __toString(): string { return '**SECRET**'; } public function __debugInfo(): ?array { return [ 'content' => '**SECRET**' ]; } public function __serialize(): array { return []; } public function __unserialize(array $data): void { throw new \RuntimeException('The ' . __CLASS__ . ' class cannot be unserialized.'); } } function t(string $n, callable $c) { echo "$n ::::::::::::::::::::::::::::::::::::::::" . PHP_EOL; try { $c(); } catch (Throwable $e) { echo $e->getMessage() . PHP_EOL; } echo PHP_EOL; } function test(Secured|SensitiveParameterValue $secured) { echo 'Test ' .get_class($secured). ' _____________________________________________________________' . PHP_EOL; t('var_dump', fn () => var_dump($secured)); t('serialize', fn () => var_dump(serialize($secured))); t('print_r', fn () => print_r($secured)); t('casting', fn () => var_dump((string) $secured)); t('var_export', fn () => var_dump(var_export($secured, true))); } test(Secured::fromString('Lorem ipsum dolor')); test(new \SensitiveParameterValue('Lorem ipsum dolor'));

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.10.0080.01018.57
8.5.00.0130.01121.95
8.4.160.0120.01219.82
8.4.150.0020.00014.05
8.4.140.0190.00417.66
8.4.130.0130.00618.87
8.4.120.0140.00624.02
8.4.110.0040.00620.85
8.4.100.0140.00718.98
8.4.90.0110.01020.59
8.4.80.0030.00618.80
8.4.70.0130.00318.10
8.4.60.0030.00518.68
8.4.50.0070.00518.85
8.4.40.0090.01217.97
8.4.30.0150.00418.81
8.4.20.0030.00619.78
8.4.10.0050.00319.69
8.3.290.0110.01020.71
8.3.280.0110.00818.73
8.3.270.0130.00716.79
8.3.260.0060.00216.70
8.3.250.0120.00618.93
8.3.240.0080.00917.35
8.3.230.0130.00716.75
8.3.220.0120.00718.88
8.3.210.0100.00416.82
8.3.200.0080.00116.66
8.3.190.0090.00919.14
8.3.180.0070.00317.24
8.3.170.0070.01119.07
8.3.160.0130.00616.86
8.3.150.0070.01317.17
8.3.140.0080.01118.99
8.3.130.0000.01018.49
8.3.120.0080.00020.89
8.3.110.0060.00318.64
8.3.100.0140.00718.42
8.3.50.0190.00018.84
8.2.300.0120.01020.42
8.2.290.0090.00920.37
8.2.280.0150.00618.66
8.2.270.0070.00717.59
8.2.260.0040.00418.33
8.2.250.0030.00616.95
8.2.240.0060.00918.79
8.2.230.0070.00318.22
8.2.220.0060.00318.51
8.2.200.0080.00417.17
8.1.340.0140.00717.77
8.1.330.0140.00521.94
8.1.320.0080.01020.17
8.1.310.0040.01518.33
8.1.300.0060.00318.36

preferences:
29.19 ms | 403 KiB | 5 Q