3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LazyLoadedMethods { protected $_data = array(); protected static $_instance; protected static function set($key, $value){ static::$_instance->_data[$key] = $value; return static::$_instance; } protected static 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) { $fn = static::getFunction(__FUNCTION__, function($value) { return trim(preg_replace('/\s\s+/', ' ', $value)); }); return $fn($v); } } var_dump(LazyLoadedMethods::toBool(-1)); var_dump(LazyLoadedMethods::parseNewLines("Some\n new\n lines\n"));

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.00716.75
8.3.50.0110.00822.21
8.3.40.0210.00319.10
8.3.30.0040.01119.26
8.3.20.0060.00320.30
8.3.10.0040.00421.85
8.3.00.0090.00018.00
8.2.180.0040.01118.38
8.2.170.0090.00922.96
8.2.160.0100.00321.02
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0120.00626.16
8.2.120.0090.00020.92
8.2.110.0060.00322.11
8.2.100.0080.00817.86
8.2.90.0050.00319.11
8.2.80.0040.00417.97
8.2.70.0000.01017.88
8.2.60.0050.00318.00
8.2.50.0060.00318.07
8.2.40.0000.00818.22
8.2.30.0050.00318.12
8.2.20.0000.00917.84
8.2.10.0000.00818.12
8.2.00.0000.00817.75
8.1.280.0140.00025.92
8.1.270.0040.00423.97
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00323.91
8.1.230.0000.01019.16
8.1.220.0060.00317.79
8.1.210.0040.00418.77
8.1.200.0040.00717.72
8.1.190.0050.00317.25
8.1.180.0050.00318.10
8.1.170.0080.00018.87
8.1.160.0000.00722.07
8.1.150.0040.00419.06
8.1.140.0030.00517.54
8.1.130.0030.00317.80
8.1.120.0000.00817.59
8.1.110.0000.00817.51
8.1.100.0040.00417.67
8.1.90.0020.00517.66
8.1.80.0000.00717.64
8.1.70.0000.00717.48
8.1.60.0060.00317.75
8.1.50.0040.00417.75
8.1.40.0050.00317.54
8.1.30.0080.00017.80
8.1.20.0000.00817.73
8.1.10.0030.00617.71
8.1.00.0040.00417.69
8.0.300.0000.00818.77
8.0.290.0000.00817.13
8.0.280.0000.00718.56
8.0.270.0060.00317.30
8.0.260.0030.00317.27
8.0.250.0070.00017.10
8.0.240.0040.00417.09
8.0.230.0000.00717.15
8.0.220.0000.00817.05
8.0.210.0000.00817.11
8.0.200.0000.00716.99
8.0.190.0040.00417.09
8.0.180.0070.00017.09
8.0.170.0000.00817.13
8.0.160.0000.00817.09
8.0.150.0040.00416.92
8.0.140.0000.00716.95
8.0.130.0000.00913.49
8.0.120.0080.00017.04
8.0.110.0000.00717.06
8.0.100.0020.00516.96
8.0.90.0050.00217.13
8.0.80.0120.00917.06
8.0.70.0040.00417.18
8.0.60.0000.00717.14
8.0.50.0080.00017.11
8.0.30.0090.00917.17
8.0.20.0130.00817.40
8.0.10.0040.00417.04
8.0.00.0060.01116.78
7.4.330.0000.00515.00
7.4.320.0030.00316.83
7.4.300.0040.00416.75
7.4.290.0030.00316.75
7.4.280.0050.00216.84
7.4.270.0000.00716.74
7.4.260.0000.00716.83
7.4.250.0070.00016.70
7.4.240.0030.00416.75
7.4.230.0000.00816.75
7.4.220.0070.01016.69
7.4.210.0030.01216.75
7.4.200.0040.00416.80
7.4.160.0120.00916.90
7.4.150.0110.00717.40
7.4.140.0110.00817.86
7.4.130.0080.01116.68
7.4.120.0110.00916.89
7.4.110.0060.01116.85
7.4.100.0140.01116.71
7.4.90.0110.00816.58
7.4.80.0140.00719.39
7.4.70.0100.00716.58
7.4.60.0110.00516.66
7.4.50.0000.00816.73
7.4.40.0070.01116.55
7.4.30.0100.00716.74
7.4.00.0100.00614.99
7.3.330.0000.00613.54
7.3.320.0030.00313.40
7.3.310.0030.00316.57
7.3.300.0030.00316.41
7.3.290.0030.01316.59
7.3.280.0090.00716.49
7.3.270.0120.03217.40
7.3.260.0050.01416.70
7.3.250.0130.00416.64
7.3.240.0180.00416.86
7.3.230.0140.00316.48
7.3.210.0030.01316.60
7.3.200.0120.01019.39
7.3.190.0060.01316.53
7.3.180.0080.00816.90
7.3.170.0030.01416.65
7.3.160.0060.01016.78
7.3.120.0050.00715.05
7.3.110.0060.00915.23
7.3.100.0040.00914.88
7.3.90.0130.00314.99
7.3.80.0060.00915.23
7.3.70.0060.00614.96
7.3.60.0000.01315.03
7.3.50.0090.00314.71
7.3.40.0100.00714.63
7.3.30.0090.00914.85
7.3.20.0000.01016.87
7.3.10.0080.00516.70
7.3.00.0030.00916.67
7.2.330.0030.01516.88
7.2.320.0110.00616.96
7.2.310.0100.00716.71
7.2.300.0060.01216.88
7.2.290.0100.00616.80
7.2.250.0080.01115.36
7.2.240.0110.00815.45
7.2.230.0030.01315.23
7.2.220.0070.00715.48
7.2.210.0060.00915.22
7.2.200.0000.01215.14
7.2.190.0090.00615.18
7.2.180.0000.01315.34
7.2.170.0070.01015.21
7.2.130.0060.00616.57
7.2.120.0050.00816.75
7.2.110.0150.00016.86
7.2.100.0030.01416.84
7.2.90.0120.00917.07
7.2.80.0110.00417.01
7.2.70.0030.01117.11
7.2.60.0060.00617.09
7.2.50.0080.00617.13
7.2.40.0110.00516.92
7.2.30.0140.00017.08
7.2.20.0030.00717.16
7.2.10.0040.01117.08
7.2.00.0030.00917.05
7.1.330.0090.00615.67
7.1.320.0090.00916.01
7.1.310.0060.00916.21
7.1.300.0060.00615.90
7.1.290.0030.01016.00
7.1.280.0070.01016.02
7.1.270.0130.00316.10
7.1.260.0030.01016.24
7.1.250.0100.00715.94
7.1.200.0040.01116.07
7.1.70.0000.01017.36
7.1.60.0090.01219.25
7.1.50.0070.01117.26
7.1.00.0000.08022.29
7.0.200.0030.00316.90
7.0.140.0000.08021.99
7.0.90.0030.04720.02
7.0.80.0030.03320.01
7.0.70.0100.03319.91
7.0.60.0070.04319.96
7.0.50.0170.05020.39
7.0.40.0070.04020.04
7.0.30.0170.03720.08
7.0.20.0070.04020.19
7.0.10.0100.03720.12
7.0.00.0030.04320.14
5.6.280.0000.07720.81
5.6.230.0030.04320.61
5.6.220.0030.04020.57
5.6.210.0100.03320.77
5.6.200.0000.04721.10
5.6.190.0000.04720.98
5.6.180.0070.06721.07
5.6.170.0100.03720.97
5.6.160.0030.05721.07
5.6.150.0030.03720.97
5.6.140.0130.03021.05
5.6.130.0200.03020.97
5.6.120.0070.04021.09
5.6.110.0030.04320.97
5.6.100.0070.08321.03
5.6.90.0070.04321.11
5.6.80.0070.07320.36
5.6.70.0070.05320.34
5.6.60.0070.04320.41
5.6.50.0130.03320.44
5.6.40.0100.07320.46
5.6.30.0030.08020.46
5.6.20.0200.03320.45
5.6.10.0030.05320.33
5.6.00.0100.06720.30
5.5.370.0030.04020.57
5.5.360.0030.04320.43
5.5.350.0070.04320.47
5.5.340.0070.04020.71
5.5.330.0030.04020.95
5.5.320.0070.04020.83
5.5.310.0070.03720.80
5.5.300.0000.04720.89
5.5.290.0070.03320.92
5.5.280.0070.03720.78
5.5.270.0000.04720.90
5.5.260.0070.08320.84
5.5.250.0070.08320.73
5.5.240.0030.04720.17
5.5.230.0030.07320.04
5.5.220.0070.05020.22
5.5.210.0030.07020.16
5.5.200.0170.07320.27
5.5.190.0200.07720.29
5.5.180.0030.05020.15
5.5.160.0070.05720.17
5.5.150.0100.05020.16
5.5.140.0100.08320.14
5.5.130.0070.07320.30
5.5.120.0070.05720.27
5.5.110.0030.04320.27
5.5.100.0100.07720.00
5.5.90.0070.08020.09
5.5.80.0070.04720.12
5.5.70.0000.08020.06
5.5.60.0100.06720.07
5.5.50.0200.06020.07
5.5.40.0100.06320.08
5.5.30.0070.07720.02
5.5.20.0070.07020.10
5.5.10.0070.06320.00
5.5.00.0100.07320.07
5.4.450.0100.03019.36
5.4.440.0070.04019.27
5.4.430.0070.07719.48
5.4.420.0070.03719.45
5.4.410.0000.04019.25
5.4.400.0000.04318.85
5.4.390.0030.04019.20
5.4.380.0170.07018.90
5.4.370.0170.03018.95
5.4.360.0130.06718.89
5.4.350.0030.06719.04
5.4.340.0100.07019.16
5.4.320.0070.04719.13
5.4.310.0070.08018.96
5.4.300.0000.07319.15
5.4.290.0070.08019.20
5.4.280.0100.07018.84
5.4.270.0070.04018.84
5.4.260.0030.05319.13
5.4.250.0030.04019.11
5.4.240.0170.06718.93
5.4.230.0070.07719.19
5.4.220.0070.07719.02
5.4.210.0100.07018.94
5.4.200.0000.05718.84
5.4.190.0030.06719.15
5.4.180.0070.04719.08
5.4.170.0070.07318.89
5.4.160.0130.07319.12
5.4.150.0030.08718.88
5.4.140.0000.05716.26
5.4.130.0130.06716.47
5.4.120.0100.06716.46
5.4.110.0070.04716.38
5.4.100.0070.04716.48
5.4.90.0030.04316.55
5.4.80.0070.04316.38
5.4.70.0000.07316.54
5.4.60.0030.07316.36
5.4.50.0070.07016.38
5.4.40.0030.07016.41
5.4.30.0070.07016.47
5.4.20.0030.06316.30
5.4.10.0070.03316.33
5.4.00.0000.04015.79
5.3.290.0100.05014.75
5.3.280.0070.04314.59
5.3.270.0000.07714.74
5.3.260.0070.07314.68
5.3.250.0100.06714.56
5.3.240.0170.06314.55
5.3.230.0030.04714.61
5.3.220.0070.07714.52
5.3.210.0100.07014.60
5.3.200.0130.06714.61
5.3.190.0030.04714.55
5.3.180.0100.07014.51
5.3.170.0100.06714.61
5.3.160.0030.05014.58
5.3.150.0070.07314.72
5.3.140.0070.07014.73
5.3.130.0130.07014.71
5.3.120.0070.05314.69
5.3.110.0000.05014.71
5.3.100.0070.03314.03
5.3.90.0000.05014.14
5.3.80.0100.07014.16
5.3.70.0170.06314.18
5.3.60.0000.06714.04
5.3.50.0130.03713.91
5.3.40.0070.07014.00
5.3.30.0030.07013.98
5.3.20.0030.07713.78
5.3.10.0030.07313.61
5.3.00.0130.06713.61
5.2.170.0070.05713.61
5.2.160.0070.03313.61
5.2.150.0130.06713.61
5.2.140.0100.06313.61
5.2.130.0100.05713.61
5.2.120.0070.03313.61
5.2.110.0070.06013.61
5.2.100.0070.06013.61
5.2.90.0100.06013.61
5.2.80.0030.06713.61
5.2.70.0100.03313.61
5.2.60.0000.06713.61
5.2.50.0030.05313.61
5.2.40.0070.06013.61
5.2.30.0030.06313.61
5.2.20.0070.05713.61
5.2.10.0030.04713.61
5.2.00.0000.06313.61
5.1.60.0100.04713.61
5.1.50.0070.04313.61
5.1.40.0030.05313.61
5.1.30.0070.04713.61
5.1.20.0100.05013.61
5.1.10.0000.04313.61
5.1.00.0070.05713.61
5.0.50.0070.04313.61
5.0.40.0000.03313.61
5.0.30.0070.05713.61
5.0.20.0030.02713.61
5.0.10.0070.03713.61
5.0.00.0030.06313.61
4.4.90.0000.03713.61
4.4.80.0070.03013.61
4.4.70.0000.04013.61
4.4.60.0030.03713.61
4.4.50.0000.02713.61
4.4.40.0000.03313.61
4.4.30.0000.02013.61
4.4.20.0030.03313.61
4.4.10.0070.03313.61
4.4.00.0100.05013.61
4.3.110.0000.03713.61
4.3.100.0070.02713.61
4.3.90.0030.03313.61
4.3.80.0070.04713.61
4.3.70.0030.02313.61
4.3.60.0070.03013.61
4.3.50.0000.03713.61
4.3.40.0070.04313.61
4.3.30.0030.03313.61
4.3.20.0000.03713.61
4.3.10.0030.03013.61
4.3.00.0000.03013.61

preferences:
46.53 ms | 401 KiB | 5 Q