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.4.20.0100.01019.57
8.4.10.0000.01623.93
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.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.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:
49.24 ms | 403 KiB | 5 Q