3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LazyLoadedMethods { protected $_data = array(); protected static $_instance; protected function set($key, $value){ static::$_instance->_data[$key] = $value; return static::$_instance; } protected function get($key){ if(array_key_exists($key, static::$_instance->_data)){ return static::$_instance->_data[$key]; } return null; } public static function getInstance() { if (!isset(static::$_instance)) { static::$_instance = new static; } return static::$_instance; } protected static function getFunction($name, $callback){ $ins = static::getInstance(); if(is_null(static::get($name))){ static::set($name, $callback); } return static::get($name); } public static function toBool($v) { $fn = static::getFunction(__FUNCTION__, function($value) { return $value == 1 || $value == true; }); return $fn($v); } public static function parseNewLines($v) { return static::getFunction($v, function($value) { return trim(preg_replace('/\s\s+/', ' ', $string)); })($v); } } var_dump(LazyLoadedMethods::toBool(-1));

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.40.0120.00918.99
8.3.30.0110.00419.04
8.3.20.0000.00720.30
8.3.10.0050.00321.95
8.3.00.0050.00317.93
8.2.170.0170.00322.96
8.2.160.0030.01020.44
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00021.09
8.2.110.0060.00322.25
8.2.100.0120.00017.72
8.2.90.0000.00819.22
8.2.80.0030.00617.97
8.2.70.0040.00717.50
8.2.60.0040.00417.93
8.2.50.0030.00518.07
8.2.40.0030.00518.22
8.2.30.0030.00518.01
8.2.20.0080.00017.67
8.2.10.0000.00718.13
8.2.00.0050.00317.75
8.1.270.0040.00422.13
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0100.00023.84
8.1.230.0070.00719.09
8.1.220.0000.00817.74
8.1.210.0000.00918.77
8.1.200.0030.00617.35
8.1.190.0030.00617.35
8.1.180.0040.00418.10
8.1.170.0050.00318.59
8.1.160.0000.00822.09
8.1.150.0030.00418.81
8.1.140.0040.00417.36
8.1.130.0000.00717.82
8.1.120.0040.00417.41
8.1.110.0000.00717.40
8.1.100.0000.00817.44
8.1.90.0040.00417.49
8.1.80.0040.00417.55
8.1.70.0000.00817.46
8.1.60.0040.00417.59
8.1.50.0000.00817.52
8.1.40.0040.00417.56
8.1.30.0000.00817.59
8.1.20.0030.00517.66
8.1.10.0030.00517.60
8.1.00.0000.00717.55
8.0.300.0040.00418.77
8.0.290.0070.00016.63
8.0.280.0030.00318.39
8.0.270.0030.00317.14
8.0.260.0000.00617.22
8.0.250.0070.00016.96
8.0.240.0070.00017.05
8.0.230.0070.00016.95
8.0.220.0030.00316.90
8.0.210.0050.00316.96
8.0.200.0050.00216.93
8.0.190.0030.00317.12
8.0.180.0040.00416.90
8.0.170.0000.00716.84
8.0.160.0040.00316.81
8.0.150.0050.00216.93
8.0.140.0000.00716.84
8.0.130.0060.00313.41
8.0.120.0030.00516.86
8.0.110.0000.00817.01
8.0.100.0050.00316.98
8.0.90.0000.00716.88
8.0.80.0070.00816.88
8.0.70.0070.00016.95
8.0.60.0040.00417.03
8.0.50.0040.00417.02
8.0.30.0120.00917.06
8.0.20.0090.01317.40
8.0.10.0070.00017.14
8.0.00.0130.00616.66
7.4.330.0030.00315.00
7.4.320.0000.00716.54
7.4.300.0030.00316.64
7.4.290.0040.00416.67
7.4.280.0040.00416.46
7.4.270.0030.00316.46
7.4.260.0060.00316.54
7.4.250.0050.00216.51
7.4.240.0050.00216.59
7.4.230.0040.00416.61
7.4.220.0080.00916.66
7.4.210.0090.00616.59
7.4.200.0000.00716.52
7.4.160.0130.00316.55
7.4.150.0100.01317.40
7.4.140.0080.01017.86
7.4.130.0050.01216.65
7.4.120.0090.00716.63
7.4.110.0030.01316.45
7.4.100.0120.00616.59
7.4.90.0030.01316.48
7.4.80.0120.00619.39
7.4.70.0090.01216.53
7.4.60.0130.00316.69
7.4.50.0050.00316.71
7.4.40.0030.01616.63
7.4.30.0000.01616.66
7.4.00.0070.01015.22
7.3.330.0060.00013.44
7.3.320.0000.00513.42
7.3.310.0000.00716.48
7.3.300.0040.00416.47
7.3.290.0050.01116.47
7.3.280.0100.00816.42
7.3.270.0110.00617.40
7.3.260.0110.01616.52
7.3.250.0130.00516.47
7.3.240.0120.00616.66
7.3.230.0110.00616.39
7.3.210.0100.00716.49
7.3.200.0030.01719.39
7.3.190.0080.01116.59
7.3.180.0000.01916.53
7.3.170.0120.00416.56
7.3.160.0120.00916.46
7.3.120.0050.01114.86
7.3.110.0080.00814.72
7.3.100.0060.00914.61
7.3.90.0030.01015.14
7.3.80.0090.00614.91
7.3.70.0030.01014.95
7.3.60.0030.01014.74
7.3.50.0080.00414.86
7.3.40.0090.00614.89
7.3.30.0090.00914.83
7.3.20.0030.00916.80
7.3.10.0040.01416.87
7.3.00.0120.00416.75
7.2.330.0060.01216.46
7.2.320.0180.00016.42
7.2.310.0060.01116.92
7.2.300.0030.01516.75
7.2.290.0160.00016.57
7.2.250.0100.01015.04
7.2.240.0060.01214.97
7.2.230.0000.01514.87
7.2.220.0000.01314.75
7.2.210.0030.00614.97
7.2.200.0070.00315.31
7.2.190.0030.01015.16
7.2.180.0120.00615.23
7.2.170.0100.00014.90
7.2.160.0100.00315.24
7.2.150.0040.01116.82
7.2.140.0060.01216.82
7.2.130.0030.01216.87
7.2.120.0060.01216.89
7.2.110.0000.01816.99
7.2.100.0040.00817.04
7.2.90.0060.00917.04
7.2.80.0060.00916.97
7.2.70.0080.01116.99
7.2.60.0110.00516.90
7.2.50.0030.01316.92
7.2.40.0070.00716.86
7.2.30.0090.00316.78
7.2.20.0100.00016.95
7.2.10.0030.00617.14
7.2.00.0080.00416.92
7.1.330.0030.01315.86
7.1.320.0030.01015.96
7.1.310.0000.01615.84
7.1.300.0000.01415.50
7.1.290.0060.00915.80
7.1.280.0000.01315.58
7.1.270.0080.00015.55
7.1.260.0060.01015.68
7.1.250.0000.01715.78
7.1.240.0110.00415.71
7.1.230.0030.01415.63
7.1.220.0000.01515.95
7.1.210.0030.00715.71
7.1.200.0030.00915.89
7.1.190.0040.01115.93
7.1.180.0060.00615.83
7.1.170.0070.01015.82
7.1.160.0060.00615.76
7.1.150.0000.01516.00
7.1.140.0000.00915.76
7.1.130.0000.01015.82
7.1.120.0070.00715.91
7.1.110.0000.01315.86
7.1.100.0060.01017.08
7.1.90.0000.01115.63
7.1.80.0040.00715.86
7.1.70.0050.00816.34
7.1.60.0100.00917.37
7.1.50.0070.01216.39
7.1.40.0060.00615.79
7.1.30.0030.00615.61
7.1.20.0060.00315.72
7.1.10.0000.01315.70
7.1.00.0100.03819.05
7.0.330.0000.01415.07
7.0.320.0030.00915.18
7.0.310.0030.00915.48
7.0.300.0060.01015.58
7.0.290.0080.00415.52
7.0.280.0040.00415.38
7.0.270.0060.00615.43
7.0.260.0030.01015.57
7.0.250.0100.00415.34
7.0.240.0000.01115.44
7.0.230.0000.01015.47
7.0.220.0030.00915.51
7.0.210.0100.00015.49
7.0.200.0070.00516.00
7.0.190.0070.00315.23
7.0.180.0030.00715.46
7.0.170.0040.00815.32
7.0.160.0030.01015.31
7.0.150.0110.00415.39
7.0.140.0090.03418.70
7.0.130.0070.00315.27
7.0.120.0000.01115.45
7.0.110.0040.00815.25
7.0.100.0040.01115.63
7.0.90.0000.01415.27
7.0.80.0080.00415.44
7.0.70.0000.01015.56
7.0.60.0090.04117.74
7.0.50.0050.04416.71
7.0.40.0080.04316.79
7.0.30.0100.02416.84
7.0.20.0140.04516.72
7.0.10.0060.03316.83
7.0.00.0090.01716.87
5.6.400.0100.00714.13
5.6.390.0060.00914.34
5.6.380.0080.00414.18
5.6.370.0040.00814.36
5.6.360.0030.00714.11
5.6.350.0030.00714.08
5.6.340.0090.00614.29
5.6.330.0060.00914.25
5.6.320.0040.00414.33
5.6.310.0030.01013.96
5.6.300.0060.00614.16
5.6.290.0000.00814.22
5.6.280.0040.04117.53
5.6.270.0050.00313.94
5.6.260.0030.01014.22
5.6.250.0040.00414.09
5.6.240.0070.00714.27
5.6.230.0040.01114.12
5.6.220.0040.00814.25
5.6.210.0100.04517.41
5.6.200.0050.02116.24
5.6.190.0090.02217.27
5.6.180.0200.03717.27
5.6.170.0180.02017.29
5.6.160.0090.04017.34
5.6.150.0060.02516.03
5.6.140.0060.02316.09
5.6.130.0030.03516.13
5.6.120.0030.04517.59
5.6.110.0120.03817.69
5.6.100.0100.04517.55
5.6.90.0110.03117.50
5.6.80.0080.04017.28
5.6.70.0000.01414.20
5.6.60.0030.00914.23
5.6.50.0040.01314.05
5.6.40.0070.00714.04
5.6.30.0040.00813.97
5.6.20.0070.01114.15
5.6.10.0120.00314.07
5.6.00.0090.00013.94
5.5.380.0120.00413.98
5.5.370.0040.00413.77
5.5.360.0060.00614.42
5.5.350.0090.04117.22
5.5.340.0080.04316.20
5.5.330.0030.04717.21
5.5.320.0050.02317.29
5.5.310.0180.02817.10
5.5.300.0050.04615.88
5.5.290.0020.02515.98
5.5.280.0050.03417.27
5.5.270.0050.02717.41
5.5.260.0090.04117.45
5.5.250.0100.03817.41
5.5.240.0100.04517.14
5.5.230.0060.00314.00
5.5.220.0060.00314.04
5.5.210.0040.01214.00
5.5.200.0030.00513.67
5.5.190.0080.00414.01
5.5.180.0110.00414.08
5.5.170.0070.00714.03
5.5.160.0040.01114.02
5.5.150.0030.00713.87
5.5.140.0080.00614.02
5.5.130.0100.00614.04
5.5.120.0100.00613.96
5.5.110.0060.01314.23
5.5.100.0040.01113.59
5.5.90.0030.00914.30
5.5.80.0030.01314.04
5.5.70.0030.00913.86
5.5.60.0130.00013.63
5.5.50.0050.00514.30
5.5.40.0070.00714.18
5.5.30.0030.01414.15
5.5.20.0000.01613.75
5.5.10.0030.01013.74
5.5.00.0040.00413.86
5.4.450.0130.02215.74
5.4.440.0080.02415.81
5.4.430.0200.02315.80
5.4.420.0170.02815.74
5.4.410.0090.02615.78
5.4.400.0250.02115.71
5.4.390.0100.04515.55
5.4.380.0130.03315.50
5.4.370.0180.03215.40
5.4.360.0220.02515.46
5.4.350.0240.02315.47
5.4.340.0260.02715.36
5.4.330.0000.00812.16
5.4.320.0080.02412.35
5.4.310.0050.02412.35
5.4.300.0060.02612.35
5.4.290.0040.02712.35
5.4.280.0090.02212.30
5.4.270.0040.02312.29
5.4.260.0040.02212.30
5.4.250.0060.02012.30
5.4.240.0040.02612.30
5.4.230.0070.02212.29
5.4.220.0040.02112.29
5.4.210.0050.02012.29
5.4.200.0040.02212.29
5.4.190.0050.02212.29
5.4.180.0070.01812.29
5.4.170.0080.02312.29
5.4.160.0040.02312.29
5.4.150.0080.01912.29
5.4.140.0070.02112.13
5.4.130.0060.02112.12
5.4.120.0050.02112.11
5.4.110.0040.02212.10
5.4.100.0050.02112.10
5.4.90.0050.02312.10
5.4.80.0070.02112.10
5.4.70.0040.02112.10
5.4.60.0030.02312.10
5.4.50.0050.02312.10
5.4.40.0080.01812.10
5.4.30.0020.02512.09
5.4.20.0040.02012.09
5.4.10.0020.02112.09
5.4.00.0060.02111.84
5.3.290.0080.02112.48
5.3.280.0050.02112.43
5.3.270.0040.02212.44
5.3.260.0040.02212.44
5.3.250.0040.02312.44
5.3.240.0050.02212.44
5.3.230.0050.02212.43
5.3.220.0060.02212.42
5.3.210.0060.02112.42
5.3.200.0020.02412.42
5.3.190.0050.02112.42
5.3.180.0050.02012.41
5.3.170.0050.01912.42
5.3.160.0060.02112.41
5.3.150.0040.02112.41
5.3.140.0070.02112.41
5.3.130.0070.02012.40
5.3.120.0060.02112.41
5.3.110.0070.02312.41
5.3.100.0050.02212.15
5.3.90.0060.02412.14
5.3.80.0010.02512.14
5.3.70.0060.02412.13
5.3.60.0070.01912.13
5.3.50.0040.02212.11
5.3.40.0070.02012.11
5.3.30.0040.02212.09
5.3.20.0070.02011.98
5.3.10.0050.02011.96
5.3.00.0050.02111.95
5.2.170.0040.0329.23
5.2.160.0030.0319.23
5.2.150.0080.0299.22
5.2.140.0060.0309.22
5.2.130.0040.0299.18
5.2.120.0050.0289.18
5.2.110.0040.0309.19
5.2.100.0070.0269.18
5.2.90.0050.0299.18
5.2.80.0030.0319.18
5.2.70.0060.0279.17
5.2.60.0050.0319.13
5.2.50.0050.0359.10
5.2.40.0070.0279.07
5.2.30.0020.0319.05
5.2.20.0060.0279.04
5.2.10.0110.0288.95
5.2.00.0040.0288.81
5.1.60.0030.0248.09
5.1.50.0040.0328.09
5.1.40.0080.0278.07
5.1.30.0010.0298.41
5.1.20.0050.0258.45
5.1.10.0040.0278.17
5.1.00.0040.0298.16
5.0.50.0060.0196.65
5.0.40.0020.0216.50
5.0.30.0060.0296.31
5.0.20.0040.0186.28
5.0.10.0040.0196.26
5.0.00.0030.0356.25
4.4.90.0020.0164.78
4.4.80.0030.0154.75
4.4.70.0030.0154.75
4.4.60.0020.0164.75
4.4.50.0020.0164.77
4.4.40.0020.0264.70
4.4.30.0030.0164.76
4.4.20.0050.0144.84
4.4.10.0020.0174.85
4.4.00.0010.0274.76
4.3.110.0030.0154.67
4.3.100.0030.0144.67
4.3.90.0030.0144.63
4.3.80.0040.0244.58
4.3.70.0020.0154.63
4.3.60.0050.0134.63
4.3.50.0020.0164.63
4.3.40.0040.0234.54
4.3.30.0010.0173.30
4.3.20.0020.0173.28
4.3.10.0020.0183.23
4.3.00.0000.01715.28

preferences:
48.16 ms | 400 KiB | 5 Q