3v4l.org

run code in 300+ PHP versions simultaneously
<?php $canonicalIds = [ 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', ]; $putContent = [ [ 'id' => 'fifth', 'value' => 55, ], [ 'id' => 'second', 'value' => 22, ], [ 'id' => 'fourth', 'value' => 44, ], [ 'id' => null, 'value' => 7, ], ]; [$toCreate, $toUpdate] = array_reduce( $putContent, static function (array $carry, array $item) use ($canonicalIds): array { [$toCreate, $toUpdate] = $carry; if (null === $item['id']) { $toCreate[] = $item; } elseif (true === in_array($item['id'], $canonicalIds, true)) { $toUpdate[$item['id']] = $item; } return [ $toCreate, $toUpdate ]; }, [ [], [] ] ); $toDelete = array_diff($canonicalIds, array_keys($toUpdate)); var_dump($toCreate, $toUpdate, $toDelete);

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.00.0100.01320.07
8.4.150.0020.00014.05
8.4.140.0130.00817.93
8.4.130.0100.00918.82
8.4.120.0120.00823.97
8.4.110.0120.00820.65
8.4.100.0090.00717.67
8.4.90.0030.00720.39
8.4.80.0080.01018.66
8.4.70.0050.00319.05
8.4.60.0130.00918.83
8.4.50.0110.00919.06
8.4.40.0110.00719.37
8.4.30.0090.01020.85
8.4.20.0100.01019.57
8.4.10.0000.01623.93
8.3.280.0120.00918.49
8.3.270.0170.00516.58
8.3.260.0060.00516.70
8.3.250.0140.00518.74
8.3.240.0140.00517.49
8.3.230.0120.00916.54
8.3.220.0070.01418.83
8.3.210.0050.00816.54
8.3.200.0050.00416.56
8.3.190.0050.00317.27
8.3.180.0100.01016.53
8.3.170.0060.00317.30
8.3.160.0120.00617.35
8.3.150.0040.01516.43
8.3.140.0060.01218.88
8.3.130.0000.00918.41
8.3.120.0070.00320.84
8.3.110.0000.00920.94
8.3.100.0090.00024.06
8.3.90.0140.00426.77
8.3.80.0090.00617.97
8.3.70.0090.00616.61
8.3.60.0120.00618.63
8.3.50.0030.01216.33
8.3.40.0160.00320.29
8.3.30.0070.00718.59
8.3.20.0070.00024.18
8.3.10.0070.00024.66
8.3.00.0040.00426.16
8.2.290.0100.00820.38
8.2.280.0060.00318.47
8.2.270.0160.00316.70
8.2.260.0100.01016.53
8.2.250.0000.00816.75
8.2.240.0060.00317.22
8.2.230.0060.00322.58
8.2.220.0090.00037.54
8.2.210.0060.00326.77
8.2.200.0030.00616.75
8.2.190.0180.00016.59
8.2.180.0160.00317.00
8.2.170.0110.00418.77
8.2.160.0070.01022.96
8.2.150.0030.01025.66
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0070.00019.77
8.2.110.0070.00421.05
8.2.100.0060.00617.91
8.2.90.0030.00520.08
8.2.80.0000.00820.36
8.2.70.0060.00318.16
8.2.60.0060.00317.93
8.2.50.0000.00818.22
8.2.40.0060.00320.37
8.2.30.0040.00418.13
8.2.20.0160.00318.94
8.2.10.0080.00718.83
8.2.00.0030.01318.92
8.1.330.0120.00822.05
8.1.320.0090.01017.86
8.1.310.0040.00416.19
8.1.300.0060.00318.56
8.1.290.0060.00330.84
8.1.280.0070.00725.92
8.1.270.0030.00523.84
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00323.86
8.1.230.0080.00422.74
8.1.220.0040.00417.79
8.1.210.0050.00518.90
8.1.200.0030.00717.36
8.1.190.0080.00017.22
8.1.180.0060.00318.10
8.1.170.0050.00318.64
8.1.160.0040.00418.90
8.1.150.0060.00218.62
8.1.140.0100.00318.65
8.1.130.0120.00118.65
8.1.120.0070.00818.69
8.1.110.0140.00418.69
8.1.100.0120.00518.72
8.1.90.0090.00518.73
8.1.80.0090.00818.69
8.1.70.0090.00718.66
8.1.60.0140.00518.82
8.1.50.0170.00418.73
8.1.40.0150.00418.83
8.1.30.0150.00318.82
8.1.20.0180.00218.80
8.1.10.0130.00618.80
8.1.00.0160.00318.67
8.0.300.0000.00720.00
8.0.290.0060.00316.63
8.0.280.0080.00018.39
8.0.270.0110.00518.01
8.0.260.0100.00717.94
8.0.250.0100.00618.01
8.0.240.0150.00217.99
8.0.230.0140.00318.06
8.0.220.0070.00917.96
8.0.210.0090.00717.95
8.0.200.0140.00118.05
8.0.190.0080.00518.04
8.0.180.0080.00818.02
8.0.170.0030.01217.95
8.0.160.0100.00517.99
8.0.150.0130.00217.91
8.0.140.0100.00417.98
8.0.130.0070.00917.96
8.0.120.0070.00817.92
8.0.110.0090.00517.93
8.0.100.0100.00818.01
8.0.90.0090.00618.00
8.0.80.0160.00318.01
8.0.70.0100.00617.95
8.0.60.0100.00917.90
8.0.50.0080.00618.05
8.0.30.0090.00417.96
8.0.20.0070.00517.97
8.0.10.0090.00518.08

preferences:
104.52 ms | 403 KiB | 5 Q