3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LazyLoadedMethods { protected $_data = array(); protected $_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) { return static::getFunction($v, function($value) { return $value == 1 || $value == true; }); } public static function parseNewLines($v) { return static::getFunction($v, function($value) { return trim(preg_replace('/\s\s+/', ' ', $string)); }); } } echo 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.60.0070.00718.55
8.3.50.0240.00321.96
8.3.40.0040.01518.66
8.3.30.0120.00919.21
8.3.20.0050.00320.16
8.3.10.0030.00521.91
8.3.00.0040.00418.05
8.2.180.0120.00317.00
8.2.170.0100.01022.96
8.2.160.0070.00720.43
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0060.00326.16
8.2.120.0040.00420.94
8.2.110.0080.00421.18
8.2.100.0120.00017.91
8.2.90.0060.00317.75
8.2.80.0000.00818.03
8.2.70.0080.00018.04
8.2.60.0030.00618.03
8.2.50.0050.00318.10
8.2.40.0040.00419.95
8.2.30.0040.00418.01
8.2.20.0000.00717.68
8.2.10.0050.00318.01
8.2.00.0040.00417.68
8.1.280.0100.01025.92
8.1.270.0050.00323.86
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00323.83
8.1.230.0090.00622.63
8.1.220.0060.00317.79
8.1.210.0030.00518.77
8.1.200.0030.00617.25
8.1.190.0030.00617.35
8.1.180.0040.00418.10
8.1.170.0040.00418.58
8.1.160.0020.00522.05
8.1.150.0040.00418.96
8.1.140.0000.00817.52
8.1.130.0000.00717.78
8.1.120.0040.00417.39
8.1.110.0040.00417.50
8.1.100.0070.00017.55
8.1.90.0050.00217.49
8.1.80.0040.00417.55
8.1.70.0000.00717.47
8.1.60.0030.00517.61
8.1.50.0040.00417.45
8.1.40.0050.00317.56
8.1.30.0060.00317.61
8.1.20.0070.00017.73
8.1.10.0000.00817.51
8.1.00.0050.00317.54
8.0.300.0040.00419.77
8.0.290.0050.00516.88
8.0.280.0000.00818.40
8.0.270.0050.00317.20
8.0.260.0080.00017.30
8.0.250.0000.00817.09
8.0.240.0030.00317.06
8.0.230.0080.00017.05
8.0.220.0040.00416.82
8.0.210.0040.00417.03
8.0.200.0030.00316.99
8.0.190.0000.00716.95
8.0.180.0030.00516.91
8.0.170.0040.00416.92
8.0.160.0070.00016.93
8.0.150.0040.00416.88
8.0.140.0040.00417.00
8.0.130.0070.00013.40
8.0.120.0030.00516.92
8.0.110.0040.00417.03
8.0.100.0050.00216.93
8.0.90.0040.00417.00
8.0.80.0090.00617.02
8.0.70.0040.00416.79
8.0.60.0000.00717.05
8.0.50.0000.00717.03
8.0.30.0070.01217.08
8.0.20.0110.00717.40
8.0.10.0040.00417.10
8.0.00.0150.00616.70
7.4.330.0060.00015.08
7.4.320.0030.00316.46
7.4.300.0060.00016.52
7.4.290.0040.00416.66
7.4.280.0040.00416.68
7.4.270.0000.00816.57
7.4.260.0000.00916.61
7.4.250.0040.00416.64
7.4.240.0020.00516.57
7.4.230.0070.00016.29
7.4.220.0100.00716.57
7.4.210.0030.01216.66
7.4.200.0000.00716.45
7.4.160.0030.01716.53
7.4.150.0100.01017.40
7.4.140.0110.00617.86
7.4.130.0110.00516.56
7.4.120.0100.01216.59
7.4.110.0070.01016.47
7.4.100.0130.00616.65
7.4.90.0070.01016.66
7.4.80.0180.00619.39
7.4.70.0120.00616.56
7.4.60.0070.01016.68
7.4.50.0000.00816.23
7.4.40.0130.00716.34
7.4.30.0110.00516.33
7.4.00.0000.01314.90
7.3.330.0030.00313.27
7.3.320.0000.00513.16
7.3.310.0030.00516.25
7.3.300.0000.00716.45
7.3.290.0140.00016.42
7.3.280.0060.01116.41
7.3.270.0070.01117.40
7.3.260.0130.01516.58
7.3.250.0080.00916.49
7.3.240.0120.00616.41
7.3.230.0110.00616.39
7.3.210.0030.01516.37
7.3.200.0150.00919.39
7.3.190.0150.00316.34
7.3.180.0120.00916.33
7.3.170.0090.00616.46
7.3.160.0160.00616.36
7.3.120.0060.00915.08
7.2.330.0060.01316.54
7.2.320.0100.00716.73
7.2.310.0050.01116.76
7.2.300.0090.01216.81
7.2.290.0090.00916.68
7.2.60.0080.00416.91
7.2.00.0090.00619.36
7.1.200.0040.01115.68
7.1.100.0090.00618.02
7.1.70.0000.00717.01
7.1.60.0100.01419.25
7.1.50.0040.01116.89
7.1.00.0000.08022.31
7.0.200.0000.00816.77
7.0.140.0000.08021.95
7.0.60.0230.04319.96
7.0.50.0100.06317.89
7.0.40.0070.04319.96
7.0.30.0230.06020.06
7.0.20.0230.05020.22
7.0.10.0030.08020.16
7.0.00.0070.04020.30
5.6.210.0130.08020.55
5.6.200.0030.05318.19
5.6.190.0030.07020.52
5.6.180.0330.07720.61
5.6.170.0330.07320.45
5.6.160.0130.04320.53
5.6.150.0030.08318.28
5.6.140.0030.08318.27
5.6.130.0100.05318.19
5.6.120.0100.08321.04
5.6.110.0100.08721.00
5.6.100.0000.09021.03
5.6.90.0070.06721.01
5.6.80.0000.06320.43
5.5.350.0130.06720.41
5.5.340.0130.07718.05
5.5.330.0070.08020.43
5.5.320.0100.07320.42
5.5.310.0200.05320.30
5.5.300.0100.06017.95
5.5.290.0070.07317.95
5.5.280.0030.07020.88
5.5.270.0170.07320.82
5.5.260.0130.08320.82
5.5.250.0200.07320.57
5.5.240.0200.07720.26
5.4.450.0470.03719.27
5.4.440.0230.04719.20
5.4.430.0230.03719.31
5.4.420.0400.04719.32
5.4.410.0300.05019.14
5.4.400.0170.04318.88
5.4.390.0170.03719.31
5.4.380.0400.07018.49
5.4.370.0330.05318.74
5.4.360.0300.05018.84
5.4.350.0330.05718.54
5.4.340.0270.05318.77
5.4.320.0080.03412.52
5.4.310.0070.03712.52
5.4.300.0060.03812.52
5.4.290.0090.03612.52
5.4.280.0050.03812.42
5.4.270.0090.03312.42
5.4.260.0050.03912.42
5.4.250.0080.03612.42
5.4.240.0040.04012.42
5.4.230.0080.04412.41
5.4.220.0080.03312.41
5.4.210.0040.04112.41
5.4.200.0100.03512.41
5.4.190.0070.03612.40
5.4.180.0040.05012.41
5.4.170.0070.04312.41
5.4.160.0080.03712.41
5.4.150.0070.03812.41
5.4.140.0050.03812.09
5.4.130.0030.04012.08
5.4.120.0050.03812.03
5.4.110.0040.03912.03
5.4.100.0040.03812.03
5.4.90.0060.03812.03
5.4.80.0080.04012.03
5.4.70.0120.04112.03
5.4.60.0080.04312.03
5.4.50.0060.03512.02
5.4.40.0070.04712.01
5.4.30.0050.03912.01
5.4.20.0120.03812.01
5.4.10.0040.03812.01
5.4.00.0030.04311.50
5.3.290.0060.03912.80
5.3.280.0050.04612.71
5.3.270.0060.04012.72
5.3.260.0040.04212.72
5.3.250.0030.04212.72
5.3.240.0060.03812.72
5.3.230.0090.03712.71
5.3.220.0100.03512.68
5.3.210.0040.04312.68
5.3.200.0040.04112.68
5.3.190.0080.03612.68
5.3.180.0080.04312.67
5.3.170.0060.03712.67
5.3.160.0060.03712.68
5.3.150.0080.04612.67
5.3.140.0090.03512.67
5.3.130.0080.03712.66
5.3.120.0080.03712.66
5.3.110.0070.03812.66
5.3.100.0070.03612.15
5.3.90.0050.03812.13
5.3.80.0040.03712.12
5.3.70.0060.03612.12
5.3.60.0090.03612.11
5.3.50.0040.03712.06
5.3.40.0050.03912.06
5.3.30.0070.03412.01
5.3.20.0070.03811.79
5.3.10.0040.03611.76
5.3.00.0050.04411.75
5.2.170.0090.0269.23
5.2.160.0060.0289.22
5.2.150.0050.0309.23
5.2.140.0010.0359.22
5.2.130.0080.0259.18
5.2.120.0040.0289.18
5.2.110.0050.0289.19
5.2.100.0040.0309.18
5.2.90.0050.0309.18
5.2.80.0030.0329.17
5.2.70.0060.0419.17
5.2.60.0040.0309.13
5.2.50.0060.0289.09
5.2.40.0050.0299.07
5.2.30.0090.0419.05
5.2.20.0040.0349.04
5.2.10.0040.0298.95
5.2.00.0030.0318.81
5.1.60.0080.0228.09
5.1.50.0040.0278.09
5.1.40.0010.0308.07
5.1.30.0040.0368.42
5.1.20.0050.0298.45
5.1.10.0010.0288.17
5.1.00.0030.0298.17
5.0.50.0020.0306.65
5.0.40.0010.0256.50
5.0.30.0060.0336.32
5.0.20.0050.0246.28
5.0.10.0040.0226.26
5.0.00.0030.0316.25
4.4.90.0040.0174.77
4.4.80.0050.0134.75
4.4.70.0030.0174.76
4.4.60.0020.0164.76
4.4.50.0040.0144.77
4.4.40.0040.0244.71
4.4.30.0000.0194.75
4.4.20.0050.0134.84
4.4.10.0030.0164.84
4.4.00.0010.0274.76
4.3.110.0010.0174.67
4.3.100.0010.0174.66
4.3.90.0030.0144.63
4.3.80.0040.0234.58
4.3.70.0020.0164.63
4.3.60.0030.0144.63
4.3.50.0010.0174.63
4.3.40.0030.0244.54
4.3.30.0020.0163.30
4.3.20.0010.0183.28
4.3.10.0000.0213.24
4.3.00.0070.01315.28

preferences:
68.75 ms | 401 KiB | 5 Q