3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (interface_exists('JsonSerializable', true) === false) { interface JsonSerializable { /** * (PHP 5 &gt;= 5.4.0)<br/> * Specify data which should be serialized to JSON * @link http://php.net/manual/en/jsonserializable.jsonserialize.php * @return mixed data which can be serialized by <b>json_encode</b>, * which is a value of any type other than a resource. */ function jsonSerialize (); } } /** * @package MXO_JSON */ abstract class MXO_JSON_Collection implements Countable, ArrayAccess, IteratorAggregate, JsonSerializable { protected $container = array(); public function __construct(array $init_array = array()) { $this->container = $init_array; } public function count() { return count($this->container); } public function offsetExists($offset) { return isset($this->container[$offset]); } public function offsetGet($offset) { return isset($this->container[$offset]) === true ? $this->container[$offset] : null; } public function getIterator() { return new ArrayIterator($this->container); } public function __clone() { $this->container = MXO_JSON::copy($this->container); } /** * returns result in raw format - for use with php's array functions * * @deprecated If you need this, consider adding more array-specific functions to MXO_JSON_Utils */ public function getRaw() { $result = array(); foreach ($this->container as $key => $element) { if ($element instanceof MXO_JSON_Collection) { $result[$key] = $element->getRaw(); } else { $result[$key] = $element; } } return $result; } /** * Like getRaw, but only converts this collection to an array; * deeper collections are left as-is. * * @deprecated If you need this, consider adding more array-specific functions to MXO_JSON_Utils */ public function getAsArray() { return $this->container; } public function keyExists($key) { return array_key_exists($key, $this->container); } public function keys() { return array_keys($this->container); } public function values() { return array_values($this->container); } public function sort($sort_flags = null) { return sort($this->container, $sort_flags); } public function rsort($sort_flags = null) { return rsort($this->container, $sort_flags); } abstract public function natsort(); abstract public function natcasesort(); public function usort($value_compare_func) { return usort($this->container, $value_compare_func); } abstract public function map($callback); abstract public function filter($callback); abstract public function merge($obj); public function search($needle) { return array_search($needle, $this->container, true); } abstract public function intersect($obj); }

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.0180.00318.43
8.3.50.0130.00622.10
8.3.40.0110.00418.53
8.3.30.0000.01418.89
8.3.20.0000.00720.29
8.3.10.0000.00923.56
8.3.00.0040.00419.13
8.2.180.0150.00316.50
8.2.170.0070.01422.96
8.2.160.0070.01120.39
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0050.00326.16
8.2.120.0080.00022.00
8.2.110.0080.00022.20
8.2.100.0040.00717.50
8.2.90.0050.00319.23
8.2.80.0080.00017.97
8.2.70.0060.00317.48
8.2.60.0000.00917.80
8.2.50.0050.00318.07
8.2.40.0050.00319.82
8.2.30.0050.00317.91
8.2.20.0000.00817.72
8.2.10.0050.00318.03
8.2.00.0060.00317.58
8.1.280.0070.01325.92
8.1.270.0060.00322.01
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00024.06
8.1.230.0040.00717.42
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0030.00617.22
8.1.190.0040.00417.10
8.1.180.0050.00318.10
8.1.170.0000.00818.64
8.1.160.0000.00722.02
8.1.150.0050.00218.86
8.1.140.0000.00717.34
8.1.130.0030.00517.68
8.1.120.0000.00817.43
8.1.110.0020.00517.34
8.1.100.0000.00717.51
8.1.90.0070.00017.50
8.1.80.0030.00517.27
8.1.70.0030.00317.31
8.1.60.0030.00517.56
8.1.50.0030.00617.40
8.1.40.0060.00317.55
8.1.30.0000.00817.54
8.1.20.0000.00817.47
8.1.10.0030.00617.32
8.1.00.0000.00717.27
8.0.300.0050.00218.77
8.0.290.0040.00416.75
8.0.280.0000.00718.42
8.0.270.0070.00017.24
8.0.260.0040.00418.43
8.0.250.0030.00316.90
8.0.240.0000.00716.82
8.0.230.0000.00716.89
8.0.220.0030.00316.76
8.0.210.0040.00416.77
8.0.200.0030.00316.94
8.0.190.0040.00416.95
8.0.180.0080.00016.85
8.0.170.0090.00016.86
8.0.160.0040.00416.71
8.0.150.0000.00716.86
8.0.140.0000.00716.80
8.0.130.0060.00313.36
8.0.120.0040.00416.75
8.0.110.0000.00716.71
8.0.100.0060.00316.95
8.0.90.0050.00216.75
8.0.80.0140.00316.80
8.0.70.0030.00616.91
8.0.60.0040.00416.92
8.0.50.0000.00716.74
8.0.30.0090.01417.10
8.0.20.0130.01017.40
8.0.10.0000.00817.09
8.0.00.0060.01516.74
7.4.330.0030.00315.02
7.4.320.0080.00016.54
7.4.300.0030.00316.59
7.4.290.0030.00316.45
7.4.280.0030.00516.54
7.4.270.0040.00416.45
7.4.260.0040.00416.46
7.4.250.0040.00416.40
7.4.240.0040.00416.44
7.4.230.0030.00316.40
7.4.220.0030.01416.46
7.4.210.0060.01016.57
7.4.200.0030.00316.60
7.4.160.0100.00716.63
7.4.150.0150.00617.40
7.4.140.0140.00417.86
7.4.130.0160.00016.51
7.4.120.0080.00816.41
7.4.110.0110.00816.54
7.4.100.0080.00916.47
7.4.90.0090.00816.28
7.4.80.0100.00719.39
7.4.70.0170.00616.53
7.4.60.0100.00716.38
7.4.50.0000.00916.32
7.4.40.0040.01416.72
7.4.30.0120.00316.64
7.4.00.0060.01214.61
7.3.330.0030.00313.14
7.3.320.0030.00313.09
7.3.310.0000.00716.27
7.3.300.0000.00716.28
7.3.290.0070.01116.22
7.3.280.0120.00516.27
7.3.270.0160.00617.40
7.3.260.0180.00016.45
7.3.250.0160.00816.38
7.3.240.0080.00816.30
7.3.230.0150.00916.39
7.3.210.0070.01116.31
7.3.200.0030.01819.39
7.3.190.0160.00416.53
7.3.180.0030.01216.32
7.3.170.0060.01616.27
7.3.160.0100.01016.46
7.3.120.0030.01314.44
7.3.110.0080.00814.36
7.3.100.0070.00714.70
7.3.90.0000.01114.91
7.3.80.0040.01114.66
7.3.70.0050.00514.48
7.3.60.0140.00014.82
7.3.50.0070.00714.61
7.3.40.0040.00714.55
7.3.30.0030.00914.45
7.3.20.0040.01216.59
7.3.10.0070.00716.75
7.3.00.0060.00316.58
7.2.330.0090.00916.45
7.2.320.0070.01016.43
7.2.310.0030.01316.74
7.2.300.0080.00816.36
7.2.290.0120.00616.68
7.2.240.0100.00314.80
7.2.230.0080.00014.95
7.2.220.0060.00914.91
7.2.210.0060.00614.96
7.2.200.0000.01414.96
7.2.190.0110.00315.05
7.2.180.0000.01315.05
7.2.170.0060.00914.99
7.2.160.0060.00615.00
7.2.150.0080.00416.85
7.2.140.0100.00716.78
7.2.130.0070.01016.79
7.2.120.0040.00816.86
7.2.110.0070.00716.66
7.2.100.0090.00916.92
7.2.90.0040.00716.65
7.2.80.0100.00616.82
7.2.70.0100.00416.89
7.2.60.0090.00316.99
7.2.50.0000.01516.87
7.2.40.0000.01416.75
7.2.30.0080.00316.88
7.2.20.0040.01216.77
7.2.10.0070.00716.90
7.2.00.0030.01217.85
7.1.330.0040.00715.90
7.1.320.0090.00615.42
7.1.310.0070.01015.80
7.1.300.0000.01015.69
7.1.290.0000.01315.70
7.1.280.0060.00615.70
7.1.270.0070.00715.60
7.1.260.0100.00315.61
7.1.250.0080.00815.58
7.1.100.0070.00717.94
7.1.70.0040.00416.95
7.1.60.0040.01919.11
7.1.50.0030.02016.99
7.1.00.0000.08022.43
7.0.200.0030.00616.41
7.0.140.0070.07322.13
7.0.60.0030.07719.98
7.0.50.0030.08717.85
7.0.40.0030.07020.28
7.0.30.0470.07020.04
7.0.20.0300.04720.30
7.0.10.0070.06020.15
7.0.00.0070.08720.07
5.6.280.0100.06721.10
5.6.210.0030.07720.59
5.6.200.0070.05018.19
5.6.190.0130.05720.54
5.6.180.0270.08320.33
5.6.170.0330.04320.43
5.6.160.0130.07020.54
5.6.150.0070.05018.16
5.6.140.0030.04018.24
5.6.130.0030.07018.27
5.6.120.0030.08721.01
5.6.110.0030.04020.97
5.6.100.0130.07721.01
5.6.90.0130.07321.02
5.6.80.0000.04720.55
5.6.70.4170.03720.41
5.5.350.0170.07020.38
5.5.340.0030.07717.98
5.5.330.0030.05020.13
5.5.320.0200.07720.42
5.5.310.0330.07320.19
5.5.300.0100.07717.97
5.5.290.0030.09317.99
5.5.280.0170.06720.77
5.5.270.0000.04320.76
5.5.260.0070.05020.92
5.5.250.0130.07320.59
5.5.240.0200.07720.18
5.4.450.0200.04719.19
5.4.440.0930.05719.46
5.4.430.0830.06319.58
5.4.420.0670.00019.68
5.4.410.0600.00019.41
5.4.400.0670.00019.38
5.4.390.0600.00019.21
5.4.380.0630.00019.12
5.4.370.0800.00019.23
5.4.360.0630.00019.25
5.4.350.0870.00018.98
5.4.340.0070.03412.03
5.4.320.0050.03712.53
5.4.310.0070.04212.52
5.4.300.0040.03912.53
5.4.290.0090.04112.52
5.4.280.0070.04112.43
5.4.270.0090.03412.42
5.4.260.0060.03712.42
5.4.250.0070.03912.42
5.4.240.0060.03512.42
5.4.230.0070.03612.41
5.4.220.0060.03512.42
5.4.210.0060.03412.41
5.4.200.0070.03712.41
5.4.190.0060.03512.41
5.4.180.0040.03912.41
5.4.170.0070.03512.42
5.4.160.0040.04012.42
5.4.150.0030.03912.41
5.4.140.0020.04212.09
5.4.130.0080.03712.09
5.4.120.0050.03512.05
5.4.110.0070.03412.04
5.4.100.0060.03912.04
5.4.90.0070.03712.04
5.4.80.0080.03712.04
5.4.70.0060.03812.04
5.4.60.0040.03712.04
5.4.50.0050.03712.03
5.4.40.0020.03712.02
5.4.30.0040.03812.02
5.4.20.0100.03412.02
5.4.10.0090.03412.02
5.4.00.0040.03711.51
5.3.290.0080.03812.80
5.3.280.0040.04312.71
5.3.270.0050.04412.72
5.3.260.0060.04312.72
5.3.250.0050.04012.72
5.3.240.0110.03712.72
5.3.230.0050.05312.71
5.3.220.0080.04212.68
5.3.210.0090.04012.68
5.3.200.0050.04112.68
5.3.190.0110.04112.68
5.3.180.0080.03612.68
5.3.170.0050.04912.67
5.3.160.0030.03912.67
5.3.150.0060.03912.68
5.3.140.0090.04012.67
5.3.130.0090.03712.66
5.3.120.0080.04312.66
5.3.110.0030.04212.66
5.3.100.0060.03612.15
5.3.90.0090.03612.14
5.3.80.0070.03412.13
5.3.70.0050.03712.13
5.3.60.0080.03712.11
5.3.50.0070.03612.06
5.3.40.0030.03912.06
5.3.30.0100.03512.01
5.3.20.0040.04211.79
5.3.10.0060.03811.77
5.3.00.0100.03611.75
5.2.170.0050.0309.26
5.2.160.0070.0299.26
5.2.150.0040.0319.26
5.2.140.0050.0369.25
5.2.130.0110.0249.21
5.2.120.0020.0309.22
5.2.110.0080.0339.23
5.2.100.0040.0319.22
5.2.90.0070.0329.22
5.2.80.0090.0299.21
5.2.70.0060.0319.21
5.2.60.0060.0349.16
5.2.50.0030.0349.14
5.2.40.0050.0309.11
5.2.30.0040.0319.09
5.2.20.0020.0329.08
5.2.10.0010.0358.98
5.2.00.0050.0308.84
5.1.60.0030.0288.14
5.1.50.0050.0278.13
5.1.40.0040.0278.11
5.1.30.0040.0328.46
5.1.20.0110.0268.48
5.1.10.0030.0288.21
5.1.00.0040.0268.21
5.0.50.0040.0256.65
5.0.40.0020.0206.51
5.0.30.0010.0336.32
5.0.20.0040.0326.28
5.0.10.0050.0186.27
5.0.00.0020.0316.26
4.4.90.0020.0164.78
4.4.80.0020.0224.76
4.4.70.0050.0174.75
4.4.60.0020.0164.75
4.4.50.0030.0154.77
4.4.40.0020.0254.71
4.4.30.0030.0144.76
4.4.20.0030.0194.84
4.4.10.0040.0174.85
4.4.00.0040.0254.76
4.3.110.0020.0184.67
4.3.100.0020.0154.66
4.3.90.0030.0144.63
4.3.80.0030.0234.59
4.3.70.0040.0184.63
4.3.60.0030.0144.63
4.3.50.0020.0174.63
4.3.40.0030.0234.54
4.3.30.0010.0173.29
4.3.20.0030.0153.27
4.3.10.0030.0143.22
4.3.00.0100.02710.05

preferences:
51.31 ms | 401 KiB | 5 Q