3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); enum Color: string { case Yellow = 'yw'; } class Foo { public function __construct( public DateTimeImmutable $date, protected string $foo, private int $bar, public array $tbl = [123, true, 1.1, 'baz'], protected Color $color = Color::Yellow, ) {} } $current = serialize(new Foo(new DateTimeImmutable('now'), "Foo bar\nbaz", 123456789)); var_dump($current); echo "\nReducing by potentially unnecessary chars...\n"; $reductions = []; $replacements = ['"' => '']; $reductions['removing double-quote'] = strtr($current, $replacements); $replacements[';}'] = '}'; $replacements[':{'] = '{'; $reductions['removing previous and array leading double-colon and trailing semi-colon'] = strtr($current, $replacements); $replacements['O:'] = 'O'; $replacements['a:'] = 'a'; $replacements['s:'] = 's'; $replacements['E:'] = 'E'; $reductions['removing previous and leading double-colon of sized types'] = strtr($current, $replacements); $replacements['i:'] = 'i'; $replacements['d:'] = 'd'; $replacements['b:'] = 'b'; $reductions['aggresive removing previous and some double-colons'] = strtr($current, $replacements); foreach ($reductions as $name => $serialized) { printf("\nBy {$name} serialized output shrinks by %0.2f%%\n", (strlen($current) - strlen($serialized)) / strlen($serialized) * 100); var_dump($serialized); }

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.4.120.0100.01024.23
8.4.110.0080.00322.63
8.4.100.0110.01018.70
8.4.90.0120.00418.74
8.4.80.0080.00120.62
8.4.70.0100.00717.96
8.4.60.0080.00518.88
8.4.50.0070.00918.83
8.4.40.0170.00318.05
8.4.30.0130.00720.63
8.4.20.0160.00320.02
8.4.10.0030.00619.76
8.3.250.0120.00718.80
8.3.240.0120.00817.39
8.3.230.0130.00716.84
8.3.220.0040.00318.93
8.3.210.0140.00616.99
8.3.200.0030.00616.84
8.3.190.0130.00617.20
8.3.180.0120.00717.17
8.3.170.0110.00718.88
8.3.160.0060.01218.55
8.3.150.0050.00317.57
8.3.140.0090.00916.86
8.3.130.0060.00318.74
8.3.120.0030.00718.82
8.3.110.0080.00022.58
8.3.100.0060.00322.58
8.3.90.0080.01222.58
8.3.50.0030.00622.58
8.3.20.0060.01323.57
8.3.10.0090.00923.65
8.3.00.0120.00920.97
8.2.290.0120.00320.54
8.2.280.0130.00818.08
8.2.270.0050.00317.47
8.2.260.0080.00016.84
8.2.250.0080.00016.59
8.2.240.0080.00417.23
8.2.230.0040.00422.58
8.2.220.0160.00322.58
8.2.210.0050.00322.58
8.2.150.0130.00621.00
8.2.140.0070.01122.06
8.2.130.0190.00022.30
8.2.120.0110.00721.11
8.2.110.0120.00621.08
8.2.100.0120.00621.01
8.2.90.0130.01020.88
8.2.80.0160.00021.26
8.2.70.0180.00320.57
8.2.60.0080.00820.74
8.2.50.0100.01021.00
8.2.40.0150.00020.80
8.2.30.0090.00620.81
8.2.20.0090.00920.64
8.2.10.0060.01220.63
8.2.00.0110.00820.54
8.1.330.0090.00922.17
8.1.320.0130.00718.15
8.1.310.0040.01416.14
8.1.300.0090.00618.71
8.1.270.0070.00723.96
8.1.260.0040.01123.80
8.1.250.0110.00423.92
8.1.240.0100.00720.59
8.1.230.0070.01020.50
8.1.220.0130.00620.83
8.1.210.0040.01120.45
8.1.200.0110.00420.71
8.1.190.0110.00720.59
8.1.180.0140.00720.41
8.1.170.0040.01120.60
8.1.160.0120.00320.55
8.1.150.0110.00320.64
8.1.140.0150.00020.52
8.1.130.0120.00320.47
8.1.120.0140.00020.54
8.1.110.0110.00420.59
8.1.100.0040.01120.41
8.1.90.0110.00320.44
8.1.80.0110.00421.63
8.1.70.0130.00320.64
8.1.60.0110.00420.57
8.1.50.0070.00720.50
8.1.40.0110.00420.58
8.1.30.0070.00720.67
8.1.20.0040.01121.84
8.1.10.0090.00620.65
8.1.00.0060.01020.45

preferences:
26.83 ms | 403 KiB | 5 Q