3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LazyLoadedMethods { protected $_data = array(); 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 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.0060.01216.75
8.3.50.0220.00721.97
8.3.40.0160.00818.84
8.3.30.0060.00819.09
8.3.20.0080.00020.21
8.3.10.0070.00021.70
8.3.00.0050.00319.80
8.2.180.0140.00416.88
8.2.170.0140.00722.96
8.2.160.0070.00720.30
8.2.150.0000.00924.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00420.80
8.2.110.0030.00622.10
8.2.100.0070.00417.91
8.2.90.0050.00319.08
8.2.80.0040.00417.97
8.2.70.0080.00017.63
8.2.60.0080.00018.04
8.2.50.0030.00618.07
8.2.40.0060.00319.70
8.2.30.0040.00417.91
8.2.20.0070.00017.63
8.2.10.0040.00418.01
8.2.00.0000.00817.68
8.1.280.0100.01025.92
8.1.270.0080.00023.79
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0040.00423.84
8.1.230.0080.00419.16
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0100.00017.23
8.1.190.0030.00617.22
8.1.180.0000.00818.10
8.1.170.0040.00418.64
8.1.160.0040.00421.93
8.1.150.0040.00418.71
8.1.140.0000.00717.30
8.1.130.0080.00017.71
8.1.120.0000.00717.37
8.1.110.0000.00717.27
8.1.100.0080.00017.28
8.1.90.0000.00717.36
8.1.80.0040.00417.25
8.1.70.0070.00017.24
8.1.60.0040.00417.43
8.1.50.0000.00917.49
8.1.40.0030.00617.38
8.1.30.0040.00417.50
8.1.20.0000.00817.66
8.1.10.0040.00417.61
8.1.00.0030.00617.54
8.0.300.0050.00318.77
8.0.290.0070.00016.63
8.0.280.0000.00718.40
8.0.270.0000.00717.15
8.0.260.0030.00318.40
8.0.250.0070.00016.89
8.0.240.0050.00316.87
8.0.230.0000.00716.88
8.0.220.0030.00316.88
8.0.210.0000.00816.84
8.0.200.0030.00316.98
8.0.190.0040.00416.97
8.0.180.0080.00016.85
8.0.170.0050.00316.84
8.0.160.0040.00416.95
8.0.150.0040.00416.87
8.0.140.0070.00016.84
8.0.130.0050.00313.43
8.0.120.0060.00316.77
8.0.110.0040.00416.93
8.0.100.0040.00416.72
8.0.90.0030.00416.86
8.0.80.0090.01516.89
8.0.70.0040.00417.03
8.0.60.0040.00416.87
8.0.50.0050.00216.70
8.0.30.0130.01017.11
8.0.20.0140.00517.40
8.0.10.0000.00717.05
8.0.00.0100.00816.81
7.4.330.0050.00015.09
7.4.320.0030.00516.47
7.4.300.0030.00316.64
7.4.290.0040.00416.45
7.4.280.0050.00516.53
7.4.270.0000.00716.56
7.4.260.0040.00416.42
7.4.250.0050.00316.64
7.4.240.0050.00216.49
7.4.230.0000.00716.52
7.4.220.0000.01716.64
7.4.210.0110.00716.65
7.4.200.0030.00316.64
7.4.160.0040.01216.48
7.4.150.0150.00317.40
7.4.140.0090.00817.86
7.4.130.0110.00616.57
7.4.120.0110.00816.48
7.4.110.0070.01116.58
7.4.100.0060.01216.64
7.4.90.0120.00616.41
7.4.80.0090.01219.39
7.4.70.0120.00616.49
7.4.60.0060.01116.54
7.4.50.0000.00916.25
7.4.40.0090.00916.45
7.4.30.0100.00616.73
7.4.00.0090.00614.90
7.3.330.0020.00213.35
7.3.320.0000.00513.37
7.3.310.0030.00316.42
7.3.300.0030.00316.32
7.3.290.0060.00916.46
7.3.280.0040.01216.33
7.3.270.0120.00617.40
7.3.260.0160.01016.66
7.3.250.0060.01216.43
7.3.240.0180.00316.43
7.3.230.0030.01416.41
7.3.210.0060.01516.38
7.3.200.0100.01319.39
7.3.190.0120.00616.52
7.3.180.0070.01016.50
7.3.170.0030.01316.51
7.3.160.0080.00816.55
7.3.120.0060.01014.60
7.3.10.0000.01216.54
7.3.00.0030.00716.61
7.2.330.0030.01416.74
7.2.320.0100.00716.55
7.2.310.0040.01316.50
7.2.300.0120.00916.45
7.2.290.0060.01016.43
7.2.130.0110.00417.04
7.2.120.0100.00717.01
7.2.110.0100.00616.80
7.2.100.0030.00817.00
7.2.90.0060.00916.97
7.2.80.0060.00916.70
7.2.70.0100.00316.91
7.2.60.0200.00816.73
7.2.50.0060.01017.00
7.2.40.0000.01116.96
7.2.30.0070.00716.90
7.2.20.0090.00616.63
7.2.10.0000.01016.55
7.2.00.0050.01018.14
7.1.250.0040.00915.90
7.1.200.0040.01115.74
7.1.100.0000.01017.95
7.1.70.0030.00617.10
7.1.60.0110.01419.25
7.1.50.0040.01116.96
7.1.00.0070.07322.36
7.0.200.0080.00016.83
7.0.140.0000.07722.21
7.0.60.0230.05319.94
7.0.50.0070.07717.89
7.0.40.0100.07019.96
7.0.30.0200.04020.13
7.0.20.0230.04020.35
7.0.10.0030.07320.09
7.0.00.0100.08320.19
5.6.210.0100.08320.49
5.6.200.0070.07718.17
5.6.190.0070.04020.46
5.6.180.0330.07320.39
5.6.170.0300.03720.46
5.6.160.0070.04020.54
5.6.150.0130.04718.18
5.6.140.0100.08018.17
5.6.130.0070.05718.14
5.6.120.0070.07021.14
5.6.110.0100.08320.98
5.6.100.0100.03320.99
5.6.90.0030.04020.97
5.6.80.0030.04720.41
5.5.350.0130.06720.35
5.5.340.0070.04717.93
5.5.330.0070.05320.35
5.5.320.0030.03720.28
5.5.310.0200.04020.31
5.5.300.0030.03718.09
5.5.290.0000.11018.08
5.5.280.0100.08020.79
5.5.270.0070.06720.86
5.5.260.0000.04320.89
5.5.250.0170.08020.71
5.5.240.0200.07720.25
5.4.450.0130.04719.50
5.4.440.0600.03719.30
5.4.430.0170.04719.29
5.4.420.0300.03719.40
5.4.410.0300.04719.39
5.4.400.0400.05018.95
5.4.390.0230.04719.08
5.4.380.0770.05018.49
5.4.370.0400.06318.78
5.4.360.0500.05318.55
5.4.350.0330.05318.60
5.4.340.0330.05318.74
5.4.320.0040.04112.53
5.4.310.0060.03912.52
5.4.300.0080.04212.52
5.4.290.0040.03912.52
5.4.280.0070.03512.42
5.4.270.0090.03512.41
5.4.260.0040.03912.41
5.4.250.0090.04012.42
5.4.240.0060.03712.42
5.4.230.0050.05012.41
5.4.220.0090.03212.41
5.4.210.0060.03612.41
5.4.200.0050.03812.41
5.4.190.0050.03612.41
5.4.180.0070.03612.40
5.4.170.0110.04612.42
5.4.160.0060.03612.41
5.4.150.0050.03712.41
5.4.140.0040.03912.09
5.4.130.0050.03512.08
5.4.120.0070.03412.04
5.4.110.0060.03512.04
5.4.100.0030.03812.04
5.4.90.0040.03912.03
5.4.80.0060.04712.03
5.4.70.0050.03612.03
5.4.60.0050.05012.03
5.4.50.0090.04312.02
5.4.40.0020.03812.02
5.4.30.0060.03612.01
5.4.20.0070.03512.01
5.4.10.0050.03512.01
5.4.00.0100.04111.50
5.3.290.0060.03912.80
5.3.280.0080.03612.70
5.3.270.0050.03912.73
5.3.260.0020.04512.72
5.3.250.0090.03812.72
5.3.240.0100.03712.72
5.3.230.0040.03912.71
5.3.220.0100.03612.68
5.3.210.0040.04312.68
5.3.200.0050.03712.68
5.3.190.0030.04112.68
5.3.180.0080.03512.68
5.3.170.0060.03612.68
5.3.160.0060.03712.68
5.3.150.0060.04212.68
5.3.140.0030.04012.66
5.3.130.0070.04212.66
5.3.120.0070.04012.66
5.3.110.0040.04112.66
5.3.100.0070.03612.15
5.3.90.0090.03412.13
5.3.80.0100.03712.12
5.3.70.0050.04212.12
5.3.60.0060.03712.11
5.3.50.0060.03612.05
5.3.40.0070.03512.05
5.3.30.0070.03312.02
5.3.20.0060.03411.80
5.3.10.0120.03211.76
5.3.00.0060.03511.75
5.2.170.0050.0299.22
5.2.160.0090.0259.23
5.2.150.0090.0319.22
5.2.140.0070.0289.22
5.2.130.0030.0339.18
5.2.120.0030.0329.18
5.2.110.0030.0309.19
5.2.100.0060.0289.18
5.2.90.0050.0309.18
5.2.80.0050.0299.17
5.2.70.0020.0329.17
5.2.60.0060.0279.13
5.2.50.0050.0299.10
5.2.40.0060.0319.07
5.2.30.0060.0379.05
5.2.20.0080.0279.04
5.2.10.0040.0288.95
5.2.00.0040.0298.81
5.1.60.0050.0238.09
5.1.50.0070.0228.09
5.1.40.0030.0298.07
5.1.30.0050.0298.42
5.1.20.0030.0278.44
5.1.10.0030.0298.17
5.1.00.0030.0278.17
5.0.50.0050.0196.65
5.0.40.0030.0256.50
5.0.30.0050.0336.32
5.0.20.0050.0266.28
5.0.10.0030.0266.26
5.0.00.0060.0306.25
4.4.90.0040.0214.78
4.4.80.0040.0134.75
4.4.70.0020.0154.75
4.4.60.0020.0164.75
4.4.50.0020.0154.77
4.4.40.0050.0244.71
4.4.30.0020.0164.76
4.4.20.0050.0144.85
4.4.10.0030.0194.85
4.4.00.0060.0264.75
4.3.110.0020.0194.67
4.3.100.0030.0214.67
4.3.90.0020.0154.63
4.3.80.0030.0274.58
4.3.70.0030.0144.63
4.3.60.0030.0144.63
4.3.50.0010.0174.63
4.3.40.0030.0254.54
4.3.30.0040.0193.30
4.3.20.0030.0153.28
4.3.10.0010.0163.24
4.3.00.0030.01315.28

preferences:
36.51 ms | 401 KiB | 5 Q