3v4l.org

run code in 300+ PHP versions simultaneously
<?php function applyDocumentCasts($keyPattern, Closure $closure) { $casts = [ 'unchanged' => fn ($item) => $item, 'object' => fn ($item) => (object) $item, // 'Serializable' => fn ($item) => new BSONDocument($item), // 'Document' => fn ($item) => Document::fromPHP($item), ]; return array_combine( array_map(fn ($castName) => sprintf($keyPattern, $castName), array_keys($casts)), array_map(fn ($cast) => $closure($cast), $casts), ); } function provideFilterDocuments(): array { $expectedQuery = (object) ['x' => 1]; return applyDocumentCasts( '%s', fn ($cast) => [$cast(['x' => 1]), $expectedQuery] ); } var_dump(provideFilterDocuments());

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.0120.00822.31
8.4.110.0110.01018.82
8.4.100.0140.00817.86
8.4.90.0110.01118.84
8.4.80.0100.00718.00
8.4.70.0110.00917.93
8.4.60.0060.00218.80
8.4.50.0110.00818.66
8.4.40.0130.00620.54
8.4.30.0130.01022.00
8.4.20.0060.00319.47
8.4.10.0030.00722.02
8.3.250.0110.00818.91
8.3.240.0100.00917.06
8.3.230.0120.00716.53
8.3.220.0090.00517.41
8.3.210.0120.00716.89
8.3.200.0050.00316.69
8.3.190.0080.00717.05
8.3.180.0140.00618.36
8.3.170.0040.00418.91
8.3.160.0000.01516.70
8.3.150.0130.00616.71
8.3.140.0030.00616.56
8.3.130.0100.01018.46
8.3.120.0030.00618.83
8.3.110.0080.00820.94
8.3.100.0040.01524.06
8.3.90.0060.00926.77
8.3.80.0040.00817.97
8.3.70.0090.00918.43
8.3.60.0140.00716.63
8.3.50.0070.00716.69
8.3.40.0070.00720.52
8.3.30.0120.00318.54
8.3.20.0050.00224.18
8.3.10.0080.00024.66
8.3.00.0000.00726.16
8.2.290.0120.00820.47
8.2.280.0100.00518.63
8.2.270.0040.00416.68
8.2.260.0060.01316.65
8.2.250.0040.00416.73
8.2.240.0030.00716.68
8.2.230.0120.00322.58
8.2.220.0000.00937.54
8.2.210.0080.00026.77
8.2.200.0090.00017.00
8.2.190.0180.00416.75
8.2.180.0100.00718.29
8.2.170.0070.01118.99
8.2.160.0110.00422.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0080.00019.77
8.2.110.0100.00021.11
8.2.100.0040.00717.91
8.2.90.0080.00018.41
8.2.80.0040.00419.23
8.2.70.0000.00817.63
8.2.60.0150.00417.63
8.2.50.0140.00517.37
8.2.40.0130.00317.50
8.2.30.0120.00717.50
8.2.20.0140.00317.50
8.2.10.0120.00617.50
8.2.00.0110.00817.38
8.1.330.0110.00720.35
8.1.320.0100.00916.39
8.1.310.0110.00716.77
8.1.300.0040.01117.88
8.1.290.0080.00430.84
8.1.280.0070.01125.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0030.00528.09
8.1.240.0060.00322.67
8.1.230.0070.00320.97
8.1.220.0040.00417.76
8.1.210.0040.00418.80
8.1.200.0050.00317.35
8.1.190.0150.00417.25
8.1.180.0100.00717.25
8.1.170.0060.01017.11
8.1.160.0120.00617.23
8.1.150.0140.00417.38
8.1.140.0110.00517.13
8.1.130.0130.00317.13
8.1.120.0100.00617.13
8.1.110.0110.00517.10
8.1.100.0170.00017.25
8.1.90.0120.00617.09
8.1.80.0120.00617.38
8.1.70.0120.00617.10
8.1.60.0150.00317.50
8.1.50.0130.00517.22
8.1.40.0130.00417.59
8.1.30.0140.00417.38
8.1.20.0190.00317.25
8.1.10.0150.00417.09
8.1.00.0120.00617.25
8.0.300.0000.00720.06
8.0.290.0050.00316.63
8.0.280.0170.00016.63
8.0.270.0120.00416.75
8.0.260.0120.00416.62
8.0.250.0090.00916.75
8.0.240.0090.00916.63
8.0.230.0080.00816.75
8.0.220.0170.00016.52
8.0.210.0120.00416.63
8.0.200.0110.00716.52
8.0.190.0120.00816.60
8.0.180.0090.00716.62
8.0.170.0110.00716.52
8.0.160.0070.01016.63
8.0.150.0120.00416.72
8.0.140.0160.00016.63
8.0.130.0170.00016.74
8.0.120.0160.00016.52
8.0.110.0080.00816.74
8.0.100.0120.00416.52
8.0.90.0080.00816.52
8.0.80.0100.00716.52
8.0.70.0050.01116.74
8.0.60.0100.00716.59
8.0.50.0120.00416.63
8.0.30.0060.01116.88
8.0.20.0110.00516.62
8.0.10.0090.00916.61

preferences:
64.82 ms | 403 KiB | 5 Q