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) { 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.0000.01416.88
8.3.50.0160.00321.94
8.3.40.0140.00418.96
8.3.30.0060.00919.01
8.3.20.0070.00020.16
8.3.10.0040.00421.73
8.3.00.0040.00417.88
8.2.180.0090.00916.88
8.2.170.0170.00322.96
8.2.160.0100.00320.47
8.2.150.0000.00724.18
8.2.140.0040.00424.66
8.2.130.0090.00926.16
8.2.120.0080.00021.04
8.2.110.0060.00322.20
8.2.100.0110.00017.84
8.2.90.0080.00019.17
8.2.80.0050.00317.97
8.2.70.0030.00517.61
8.2.60.0080.00017.93
8.2.50.0040.00418.07
8.2.40.0050.00319.95
8.2.30.0040.00418.07
8.2.20.0000.00817.77
8.2.10.0000.00818.06
8.2.00.0070.00017.64
8.1.280.0160.00325.92
8.1.270.0040.00423.71
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0090.00018.86
8.1.230.0090.00319.23
8.1.220.0060.00317.76
8.1.210.0050.00318.77
8.1.200.0040.00417.36
8.1.190.0030.00517.23
8.1.180.0080.00018.10
8.1.170.0040.00418.63
8.1.160.0020.00522.00
8.1.150.0000.00718.95
8.1.140.0040.00417.36
8.1.130.0000.00717.86
8.1.120.0000.00717.51
8.1.110.0000.00717.48
8.1.100.0000.00717.41
8.1.90.0030.00417.47
8.1.80.0000.00817.49
8.1.70.0000.00717.45
8.1.60.0040.00417.61
8.1.50.0050.00317.54
8.1.40.0000.00817.56
8.1.30.0030.00617.59
8.1.20.0040.00417.57
8.1.10.0000.00817.65
8.1.00.0000.00817.55
8.0.300.0050.00218.77
8.0.290.0000.00716.75
8.0.280.0070.00018.48
8.0.270.0000.00817.31
8.0.260.0000.00717.15
8.0.250.0000.00717.03
8.0.240.0000.00717.02
8.0.230.0080.00017.04
8.0.220.0000.00716.94
8.0.210.0050.00316.88
8.0.200.0070.00017.05
8.0.190.0050.00316.92
8.0.180.0040.00417.07
8.0.170.0050.00317.00
8.0.160.0000.00716.92
8.0.150.0040.00416.83
8.0.140.0040.00416.95
8.0.130.0090.00013.41
8.0.120.0030.00516.97
8.0.110.0050.00216.90
8.0.100.0040.00417.02
8.0.90.0040.00416.82
8.0.80.0070.01016.92
8.0.70.0070.00016.97
8.0.60.0000.00816.80
8.0.50.0000.00816.87
8.0.30.0110.00817.09
8.0.20.0080.01117.40
8.0.10.0040.00416.92
8.0.00.0110.00616.87
7.4.330.0050.00015.00
7.4.320.0040.00416.55
7.4.300.0040.00416.38
7.4.290.0040.00416.54
7.4.280.0080.00016.53
7.4.270.0000.00716.55
7.4.260.0040.00416.60
7.4.250.0000.00916.52
7.4.240.0040.00416.58
7.4.230.0070.00016.41
7.4.220.0080.00816.56
7.4.210.0070.00716.65
7.4.200.0000.00716.67
7.4.160.0040.01216.49
7.4.150.0170.00017.40
7.4.140.0130.00517.86
7.4.130.0040.01316.58
7.4.120.0080.01516.64
7.4.110.0040.01416.59
7.4.100.0060.01316.57
7.4.90.0070.01016.46
7.4.80.0090.00919.39
7.4.70.0040.01416.47
7.4.60.0030.01416.48
7.4.50.0000.00516.22
7.4.40.0070.01316.55
7.4.30.0080.00816.59
7.4.00.0100.00814.80
7.3.330.0000.00513.19
7.3.320.0000.00513.38
7.3.310.0000.00716.32
7.3.300.0000.00716.43
7.3.290.0060.00916.53
7.3.280.0110.00716.44
7.3.270.0130.00617.40
7.3.260.0090.00916.39
7.3.250.0130.00416.36
7.3.240.0100.01016.63
7.3.230.0130.00316.70
7.3.210.0160.00316.72
7.3.200.0150.00719.39
7.3.190.0100.01016.69
7.3.180.0160.00316.43
7.3.170.0040.01116.59
7.3.160.0090.01516.59
7.3.120.0060.01014.94
7.3.110.0070.01014.89
7.3.100.0050.00914.97
7.3.90.0040.00814.80
7.3.80.0090.00514.91
7.3.70.0040.00714.95
7.3.60.0000.01514.73
7.3.50.0080.00414.86
7.3.40.0070.00714.79
7.3.30.0060.00714.91
7.3.20.0060.00316.67
7.3.10.0090.00516.70
7.3.00.0110.00216.61
7.2.330.0070.01616.52
7.2.320.0100.00716.87
7.2.310.0120.00416.77
7.2.300.0070.01016.87
7.2.290.0000.01716.73
7.2.250.0120.00615.28
7.2.240.0040.01415.23
7.2.230.0070.00515.03
7.2.220.0030.00915.18
7.2.210.0080.00815.22
7.2.200.0000.01714.90
7.2.190.0070.00715.25
7.2.180.0040.00915.17
7.2.170.0080.00614.98
7.2.160.0060.00615.09
7.2.150.0000.01117.05
7.2.140.0070.00316.62
7.2.130.0060.00917.17
7.2.120.0060.00316.93
7.2.110.0060.00617.06
7.2.100.0000.01417.02
7.2.90.0030.00917.11
7.2.80.0130.00017.15
7.2.70.0120.00317.09
7.2.60.0060.00717.00
7.2.50.0080.00616.82
7.2.40.0090.00617.16
7.2.30.0100.00417.10
7.2.20.0000.01617.12
7.2.10.0060.00916.90
7.2.00.0050.01018.15
7.1.330.0000.01515.88
7.1.320.0080.00516.04
7.1.310.0020.01215.88
7.1.300.0060.00515.67
7.1.290.0030.00815.76
7.1.280.0040.00915.79
7.1.270.0050.00715.77
7.1.260.0070.00515.81
7.1.250.0090.00616.01
7.1.200.0150.00515.52
7.1.100.0040.01118.09
7.1.70.0040.00416.96
7.1.60.0100.01419.25
7.1.50.0110.01117.14
7.1.00.0070.07322.36
7.0.200.0030.00516.48
7.0.140.0030.07322.15
7.0.60.0100.08321.82
7.0.50.0100.07717.88
7.0.40.0170.05020.27
7.0.30.0530.07320.16
7.0.20.0330.04720.24
7.0.10.0230.05020.32
7.0.00.0130.08320.16
5.6.280.0030.07720.93
5.6.210.0000.08720.49
5.6.200.0070.07318.25
5.6.190.0100.07720.62
5.6.180.0330.07020.48
5.6.170.0170.04020.50
5.6.160.0030.04020.50
5.6.150.0170.07018.21
5.6.140.0100.07318.14
5.6.130.0000.05318.15
5.6.120.0070.08321.01
5.6.110.0070.07020.98
5.6.100.0030.08321.14
5.6.90.0170.06721.05
5.6.80.0070.08320.45
5.5.350.4200.04020.55
5.5.340.0030.09017.99
5.5.330.0030.06320.45
5.5.320.0400.07320.38
5.5.310.0300.08320.36
5.5.300.0070.08317.98
5.5.290.0070.08317.98
5.5.280.0170.07020.67
5.5.270.0070.08720.70
5.5.260.0070.08720.75
5.5.250.0100.08320.57
5.5.240.0130.06320.38
5.4.450.0470.04319.42
5.4.440.0370.04319.27
5.4.430.0530.04319.47
5.4.420.0230.03719.27
5.4.410.0270.04019.07
5.4.400.0200.03718.85
5.4.390.0270.04019.24
5.4.380.0400.05318.71
5.4.370.0370.05718.78
5.4.360.0330.05318.79
5.4.350.0530.03718.59
5.4.340.0530.05318.61
5.4.320.0080.03912.53
5.4.310.0050.04012.52
5.4.300.0080.04212.52
5.4.290.0060.03912.52
5.4.280.0070.03712.42
5.4.270.0020.04212.42
5.4.260.0060.03712.42
5.4.250.0100.04312.42
5.4.240.0070.03612.43
5.4.230.0050.04112.41
5.4.220.0080.04012.42
5.4.210.0060.03712.41
5.4.200.0100.03412.41
5.4.190.0070.03812.41
5.4.180.0060.03812.41
5.4.170.0060.03612.42
5.4.160.0060.03712.42
5.4.150.0030.04212.41
5.4.140.0050.04412.10
5.4.130.0080.03312.09
5.4.120.0050.03712.04
5.4.110.0060.03512.04
5.4.100.0050.03912.04
5.4.90.0100.03212.04
5.4.80.0060.03712.03
5.4.70.0060.03512.03
5.4.60.0080.03212.03
5.4.50.0060.03512.02
5.4.40.0080.03112.01
5.4.30.0060.03512.01
5.4.20.0070.03412.01
5.4.10.0070.03412.01
5.4.00.0070.03511.50
5.3.290.0040.04112.80
5.3.280.0070.03712.71
5.3.270.0090.03612.73
5.3.260.0070.03912.72
5.3.250.0040.04812.72
5.3.240.0070.03712.72
5.3.230.0040.04012.71
5.3.220.0070.03612.68
5.3.210.0100.03812.68
5.3.200.0030.04312.68
5.3.190.0080.03612.68
5.3.180.0090.03412.68
5.3.170.0070.03512.68
5.3.160.0080.03812.68
5.3.150.0070.03612.67
5.3.140.0050.04412.67
5.3.130.0080.04612.66
5.3.120.0080.04712.66
5.3.110.0060.04012.66
5.3.100.0060.03812.15
5.3.90.0040.03912.13
5.3.80.0090.03912.13
5.3.70.0060.03712.12
5.3.60.0080.03512.11
5.3.50.0090.04012.05
5.3.40.0060.04112.05
5.3.30.0010.04012.01
5.3.20.0060.03511.80
5.3.10.0050.03511.76
5.3.00.0100.03611.75
5.2.170.0040.0329.23
5.2.160.0090.0259.22
5.2.150.0060.0299.23
5.2.140.0030.0329.22
5.2.130.0050.0289.18
5.2.120.0050.0289.18
5.2.110.0040.0329.19
5.2.100.0030.0329.18
5.2.90.0040.0309.18
5.2.80.0050.0309.17
5.2.70.0070.0299.17
5.2.60.0040.0329.13
5.2.50.0030.0319.09
5.2.40.0040.0299.08
5.2.30.0040.0329.05
5.2.20.0050.0289.04
5.2.10.0020.0338.95
5.2.00.0060.0328.81
5.1.60.0030.0308.09
5.1.50.0040.0258.09
5.1.40.0040.0298.07
5.1.30.0080.0248.42
5.1.20.0050.0278.45
5.1.10.0050.0258.16
5.1.00.0050.0268.17
5.0.50.0040.0196.65
5.0.40.0040.0186.50
5.0.30.0040.0306.31
5.0.20.0020.0216.28
5.0.10.0050.0186.26
5.0.00.0030.0376.25
4.4.90.0070.0214.78
4.4.80.0050.0174.75
4.4.70.0040.0144.75
4.4.60.0020.0164.75
4.4.50.0060.0124.77
4.4.40.0030.0284.71
4.4.30.0050.0164.76
4.4.20.0020.0164.84
4.4.10.0050.0134.85
4.4.00.0020.0264.76
4.3.110.0050.0194.67
4.3.100.0020.0154.66
4.3.90.0050.0164.64
4.3.80.0040.0234.58
4.3.70.0040.0134.63
4.3.60.0030.0154.63
4.3.50.0030.0154.63
4.3.40.0040.0234.54
4.3.30.0030.0153.30
4.3.20.0000.0223.28
4.3.10.0030.0153.24
4.3.00.0000.01715.28

preferences:
43.93 ms | 401 KiB | 5 Q