3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); namespace Acme { class Collection { private $_items; public function __construct(array $items = [])/*: void*/ { $this->_items = $items; } public function filter(callable $callback): self { foreach ($this->_items as $key => $value) { if (!call_user_func($callback, $value)) { unset($this->_items[$key]); } } return $this; } public function map(callable $callback): self { foreach ($this->_items as $key => $value) { $this->_items[$key] = call_user_func($callback, $key, $value); } return $this; } public function reindex(): self { $this->_items = array_values($this->_items); return $this; } public function sprintf(string $format): self { return $this->map(function ($key, $value) use ($format) { return substr_count($format, '%s') === 1 ? sprintf($format, $value) : sprintf($format, $key, $value); }); } public function implode(string $delimiter = ''): string { $output = ''; $first = TRUE; foreach ($this->_items as $value) { if ($first) { $output .= $value; $first = FALSE; } else { $output .= "$delimiter$value"; } } return $output; } public static function property(string $property): callable { return function ($key, $value) use ($property) { return $value->$property; }; } } } namespace { use Acme\Collection; echo (new Collection([ 'one', 'two', (object)['foo' => 'FOO', 'bar' => 'BAR', 'baz' => 'BAZ'], 'three', (object)['bar' => 'BAR', 'qux' => 'QUX'], ])) ->filter('is_object') ->map(Collection::property('bar')) //->reindex() ->sprintf('(%s,%s)') ->implode('_'); }

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.3.60.0110.00418.31
8.3.50.0120.00721.13
8.3.40.0060.01218.80
8.3.30.0130.00319.02
8.3.20.0040.00420.20
8.3.10.0040.00423.53
8.3.00.0040.00423.70
8.2.180.0150.00418.29
8.2.170.0110.00422.96
8.2.160.0030.01320.52
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0000.00919.73
8.2.120.0070.00026.35
8.2.110.0000.00922.20
8.2.100.0090.00318.05
8.2.90.0040.00418.85
8.2.80.0000.00918.04
8.2.70.0060.00317.75
8.2.60.0000.00817.93
8.2.50.0000.00818.07
8.2.40.0040.00421.99
8.2.30.0040.00419.54
8.2.20.0000.00717.91
8.2.10.0000.00818.15
8.2.00.0040.00418.25
8.1.280.0030.01025.92
8.1.270.0050.00323.79
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0060.00323.80
8.1.230.0030.00819.09
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0030.00617.48
8.1.190.0000.00817.48
8.1.180.0040.00418.10
8.1.170.0000.00818.78
8.1.160.0080.00020.82
8.1.150.0000.00718.98
8.1.140.0050.00319.71
8.1.130.0050.00317.71
8.1.120.0000.00717.44
8.1.110.0000.00817.57
8.1.100.0000.00817.42
8.1.90.0000.00817.48
8.1.80.0050.00217.55
8.1.70.0040.00417.42
8.1.60.0040.00417.64
8.1.50.0050.00317.46
8.1.40.0000.00817.45
8.1.30.0030.00617.65
8.1.20.0040.00417.55
8.1.10.0000.00817.55
8.1.00.0030.00517.61
8.0.300.0000.00818.77
8.0.290.0030.00617.00
8.0.280.0040.00418.46
8.0.270.0070.00017.20
8.0.260.0000.00617.32
8.0.250.0030.00317.06
8.0.240.0000.00716.98
8.0.230.0040.00416.96
8.0.220.0030.00417.00
8.0.210.0000.00716.98
8.0.200.0030.00316.95
8.0.190.0040.00417.07
8.0.180.0000.00716.87
8.0.170.0050.00316.99
8.0.160.0000.00717.07
8.0.150.0040.00416.92
8.0.140.0030.00516.88
8.0.130.0000.00613.48
8.0.120.0060.00316.89
8.0.110.0040.00417.06
8.0.100.0020.00516.90
8.0.90.0000.00717.03
8.0.80.0120.00417.07
8.0.70.0040.00416.99
8.0.60.0030.00616.88
8.0.50.0040.00416.80
8.0.30.0090.01217.20
8.0.20.0090.01117.41
8.0.10.0000.00716.97
8.0.00.0060.01616.85
7.4.330.0060.00016.77
7.4.320.0070.00016.50
7.4.300.0040.00416.55
7.4.290.0070.00016.59
7.4.280.0040.00716.55
7.4.270.0070.00016.66
7.4.260.0000.00716.59
7.4.250.0000.00816.49
7.4.240.0030.00516.53
7.4.230.0050.00216.40
7.4.220.0130.01316.68
7.4.210.0100.00516.61
7.4.200.0070.00016.51
7.4.160.0070.01016.70
7.4.150.0060.01617.40
7.4.140.0090.00917.86
7.4.130.0070.01216.42
7.4.120.0070.01116.52
7.4.110.0110.00716.74
7.4.100.0030.01416.45
7.4.90.0160.00616.43
7.4.80.0160.00319.39
7.4.70.0150.00616.62
7.4.60.0040.01216.44
7.4.50.0050.00716.50
7.4.40.0090.00916.69
7.4.30.0140.00316.57
7.4.10.0060.01214.91
7.4.00.0080.00715.09
7.3.330.0050.00013.47
7.3.320.0000.00513.41
7.3.310.0070.00016.27
7.3.300.0040.00416.51
7.3.290.0030.00316.45
7.3.280.0110.00516.42
7.3.270.0060.01617.40
7.3.260.0150.00916.59
7.3.250.0130.00516.33
7.3.240.0070.01316.56
7.3.230.0160.00316.50
7.3.210.0100.01416.69
7.3.200.0080.01219.39
7.3.190.0070.01016.48
7.3.180.0090.00716.46
7.3.170.0090.00616.39
7.3.160.0120.00316.41
7.3.130.0060.01014.85
7.3.120.0080.00614.98
7.3.110.0050.00915.02
7.3.100.0050.00914.75
7.3.90.0030.01014.84
7.3.80.0090.00515.03
7.3.70.0070.00714.80
7.3.60.0080.00814.81
7.3.50.0050.01014.77
7.3.40.0030.01114.64
7.3.30.0060.00614.74
7.3.20.0090.00616.64
7.3.10.0090.00416.62
7.3.00.0030.00616.60
7.2.330.0090.00916.80
7.2.320.0130.00716.92
7.2.310.0070.01016.52
7.2.300.0100.00716.88
7.2.290.0070.01716.84
7.2.260.0110.00715.22
7.2.250.0070.00715.07
7.2.240.0060.00815.13
7.2.230.0080.00714.96
7.2.220.0050.01415.23
7.2.210.0030.00815.24
7.2.200.0020.01014.96
7.2.190.0080.00715.21
7.2.180.0040.01014.97
7.2.170.0050.01015.22
7.2.160.0110.00414.93
7.2.150.0110.00416.98
7.2.140.0070.01016.93
7.2.130.0070.00316.79
7.2.120.0100.00316.69
7.2.110.0030.00617.05
7.2.100.0060.00616.84
7.2.90.0070.00316.68
7.2.80.0000.01116.79
7.2.70.0030.01317.17
7.2.60.0080.00717.06
7.2.50.0070.01116.96
7.2.40.0030.01016.97
7.2.30.0110.00716.97
7.2.20.0030.01016.99
7.2.10.0090.00016.65
7.2.00.0040.01117.95
7.1.330.0050.01115.68
7.1.320.0070.00715.89
7.1.310.0040.01315.83
7.1.300.0050.01115.89
7.1.290.0070.00715.98
7.1.280.0010.00915.85
7.1.270.0050.00715.76
7.1.260.0060.00715.84
7.1.250.0070.00315.87
7.1.240.0060.00915.60
7.1.230.0100.00315.54
7.1.220.0030.00615.81
7.1.210.0090.00615.93
7.1.200.0030.00915.73
7.1.190.0120.00615.61
7.1.180.0090.01015.94
7.1.170.0120.00615.63
7.1.160.0040.01115.83
7.1.150.0070.00715.97
7.1.140.0030.00615.61
7.1.130.0040.00916.00
7.1.120.0030.00615.80
7.1.110.0040.00816.01
7.1.100.0050.00616.94
7.1.90.0110.00615.80
7.1.80.0070.01015.81
7.1.70.0050.00716.62
7.1.60.0110.00717.44
7.1.50.0020.00916.43
7.1.40.0030.01216.00
7.1.30.0040.00715.70
7.1.20.0030.01415.75
7.1.10.0100.00715.76
7.1.00.0060.04019.01
7.0.330.0000.01515.14
7.0.320.0080.00415.46
7.0.310.0000.00915.26
7.0.300.0000.00915.41
7.0.290.0030.00515.25
7.0.280.0070.00715.26
7.0.270.0030.01015.53
7.0.260.0040.01115.50
7.0.250.0110.00415.47
7.0.240.0000.01215.50
7.0.230.0070.00315.61
7.0.220.0070.00715.37
7.0.210.0100.00315.43
7.0.200.0080.00315.98
7.0.190.0110.00415.54
7.0.180.0030.01015.45
7.0.170.0040.01215.45
7.0.160.0070.01015.40
7.0.150.0060.00315.13
7.0.140.0100.00315.27
7.0.130.0030.00715.36
7.0.120.0000.01115.45
7.0.110.0060.00615.32
7.0.100.0100.00015.42
7.0.90.0070.00415.41
7.0.80.0070.00715.57
7.0.70.0070.01015.45
7.0.60.0190.04018.55
7.0.50.0100.02316.74
7.0.40.0080.02316.95
7.0.30.0170.04416.88
7.0.20.0080.02716.79
7.0.10.0030.05016.87
7.0.00.0110.02616.89
5.6.400.0040.01514.13
5.6.390.0070.00314.12
5.6.380.0060.01014.28
5.6.370.0030.01314.35
5.6.360.0030.01014.30
5.6.350.0130.00314.30
5.6.340.0030.00614.24
5.6.330.0030.01014.13
5.6.320.0070.00714.04
5.6.310.0080.00814.24
5.6.300.0030.00714.05
5.6.290.0110.00414.27
5.6.280.0060.01817.69
5.6.270.0070.01014.04
5.6.260.0070.01014.21
5.6.250.0040.00414.38
5.6.240.0040.01114.17
5.6.230.0060.00614.23
5.6.220.0040.00414.22
5.6.210.0030.02317.24
5.6.200.0050.04716.17
5.6.190.0120.04317.22
5.6.180.0250.03717.31
5.6.170.0150.04217.29
5.6.160.0100.03017.35
5.6.150.0090.04715.99
5.6.140.0090.04516.14
5.6.130.0090.04116.14
5.6.120.0050.03517.56
5.6.110.0030.05117.61
5.6.100.0100.04117.66
5.6.90.0020.02917.38
5.6.80.0100.03517.19
5.6.70.0030.00714.25
5.6.60.0080.00014.05
5.6.50.0000.01514.20
5.6.40.0000.01113.98
5.6.30.0100.00313.97
5.6.20.0090.00313.96
5.6.10.0070.00714.06
5.6.00.0120.00313.92
5.5.380.0080.00414.08
5.5.370.0060.00313.92
5.5.360.0040.00814.00
5.5.350.0230.04217.38
5.5.340.0050.03416.09
5.5.330.0090.04317.10
5.5.320.0310.04317.11
5.5.310.0160.02017.21
5.5.300.0100.03716.00
5.5.290.0070.04616.20
5.5.280.0030.05217.29
5.5.270.0140.04217.19
5.5.260.0070.04717.38
5.5.250.0020.04617.25
5.5.240.0100.02417.02
5.5.230.0030.00913.98
5.5.220.0030.00914.02
5.5.210.0080.00613.85
5.5.200.0150.00013.65
5.5.190.0000.00914.11
5.5.180.0060.00614.12
5.5.170.0120.00013.70
5.5.160.0030.00914.07
5.5.150.0030.01014.05
5.5.140.0070.00713.83
5.5.130.0060.00914.17
5.5.120.0030.01214.21
5.5.110.0040.01214.15
5.5.100.0120.00313.93
5.5.90.0030.00513.75
5.5.80.0040.00713.73
5.5.70.0030.01013.64
5.5.60.0110.00414.04
5.5.50.0030.01013.89
5.5.40.0060.00613.94
5.5.30.0100.00313.95
5.5.20.0060.00613.87
5.5.10.0000.01314.09
5.5.00.0100.00714.03

preferences:
55.99 ms | 401 KiB | 5 Q