3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subscriberTags = json_decode('{"hu":2174325}'); $availableTags = json_decode('{"cz":2174305,"hu":2174325,"at":2174333,"de":2174353,"pl":2174365,"sk":2174373,"gb":2174381,"nl":2174385,"gr":2174877,"ru":2174881}'); $actualSubscriberTags = []; $addTags = []; $removeTags = []; foreach (['us', 'hu'] as $country) { $actualSubscriberTags[] = $country; if (!array_key_exists($country, $subscriberTags) && !in_array($country, $addTags)) { $addTags[] = $country; } } foreach (array_keys($subscriberTags) as $tag) { if (!in_array($tag, $actualSubscriberTags) && !in_array($tag, $removeTags)) { $removeTags[] = $tag; } } foreach ($addTags as $tag) { if (!array_key_exists($tag, $availableTags)) { echo 'ADD TAG ' . $tag . PHP_EOL; $availableTags[$tag] = 'created' . rand(0, 100); } echo 'ADD TO USER' . $availableTags[$tag] . PHP_EOL; } foreach ($removeTags as $tag) { echo 'REMOVE FROM USER' . $availableTags[$tag] . PHP_EOL; }

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)
7.4.20.0060.01016.55
7.4.10.0040.01916.44
7.4.00.0130.00916.51
7.3.140.0090.01216.38
7.3.130.0040.01816.53
7.3.120.0030.01716.53
7.3.110.0040.01116.49
7.3.100.0060.01316.46
7.3.90.0120.00616.52
7.3.80.0100.01316.34
7.3.70.0100.00716.18
7.3.60.0090.01216.40
7.3.50.0120.00416.37
7.3.40.0070.01116.34
7.3.30.0070.01016.38
7.3.20.0060.00916.35
7.3.10.0090.00616.25
7.3.00.0130.00316.29
7.2.270.0130.01016.79
7.2.260.0110.01116.69
7.2.250.0040.01116.53
7.2.240.0070.01416.55
7.2.230.0100.01016.77
7.2.220.0100.01316.41
7.2.210.0070.01116.66
7.2.200.0060.01316.55
7.2.190.0100.00616.54
7.2.180.0090.00916.58
7.2.170.0090.00916.66
7.2.160.0080.00816.57
7.2.150.0030.01316.51
7.2.140.0160.00016.57
7.2.130.0090.00916.47
7.2.120.0100.00716.35
7.2.110.0130.01016.47
7.2.100.0290.01016.58
7.2.90.0050.01116.50
7.2.80.0120.00616.55
7.2.70.0160.00616.52
7.2.60.0160.00716.34
7.2.50.0130.00916.51
7.2.40.0130.01016.43
7.2.30.0080.00816.72
7.2.20.0060.00916.63
7.2.10.0090.00616.34
7.2.00.0030.01316.55

preferences:
38.76 ms | 400 KiB | 5 Q