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+/', ' ', $string)); }); 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.0040.01116.75
8.3.50.0070.01122.12
8.3.40.0210.00319.13
8.3.30.0040.01119.27
8.3.20.0040.00420.13
8.3.10.0040.00421.82
8.3.00.0080.00018.03
8.2.180.0070.01416.75
8.2.170.0070.00722.96
8.2.160.0130.00720.35
8.2.150.0060.00324.18
8.2.140.0000.00924.66
8.2.130.0000.00726.16
8.2.120.0050.00319.66
8.2.110.0040.00422.08
8.2.100.0040.00718.16
8.2.90.0030.00619.21
8.2.80.0030.00518.00
8.2.70.0050.00317.88
8.2.60.0080.00417.93
8.2.50.0040.00418.07
8.2.40.0040.00418.22
8.2.30.0040.00418.12
8.2.20.0040.00417.98
8.2.10.0030.00518.11
8.2.00.0000.00718.05
8.1.280.0100.01025.92
8.1.270.0000.00923.79
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0090.00024.00
8.1.230.0030.00919.16
8.1.220.0000.00817.75
8.1.210.0000.00918.77
8.1.200.0060.00317.60
8.1.190.0090.00017.48
8.1.180.0060.00318.10
8.1.170.0030.00618.84
8.1.160.0020.00522.06
8.1.150.0070.00018.97
8.1.140.0030.00517.64
8.1.130.0030.00317.93
8.1.120.0000.00717.54
8.1.110.0000.00717.56
8.1.100.0080.00017.55
8.1.90.0000.00717.54
8.1.80.0000.00717.55
8.1.70.0030.00317.53
8.1.60.0030.00517.80
8.1.50.0000.00817.70
8.1.40.0030.00517.61
8.1.30.0060.00317.89
8.1.20.0030.00517.85
8.1.10.0040.00417.82
8.1.00.0000.00717.60
8.0.300.0070.00018.77
8.0.290.0000.00717.00
8.0.280.0030.00318.54
8.0.270.0070.00017.26
8.0.260.0060.00017.16
8.0.250.0000.00717.08
8.0.240.0000.00717.21
8.0.230.0030.00317.21
8.0.220.0030.00317.09
8.0.210.0050.00317.02
8.0.200.0070.00017.24
8.0.190.0030.00517.16
8.0.180.0000.00717.18
8.0.170.0000.00817.09
8.0.160.0020.00517.01
8.0.150.0040.00417.09
8.0.140.0000.00717.00
8.0.130.0080.00013.55
8.0.120.0080.00017.06
8.0.110.0040.00417.18
8.0.100.0000.00716.98
8.0.90.0050.00317.18
8.0.80.0080.00817.10
8.0.70.0000.00717.13
8.0.60.0030.00517.00
8.0.50.0040.00417.03
8.0.30.0130.00717.27
8.0.20.0090.00917.52
8.0.10.0070.00017.11
8.0.00.0120.00716.77
7.4.330.0020.00215.16
7.4.320.0030.00316.89
7.4.300.0000.00816.85
7.4.290.0040.00416.75
7.4.280.0050.00216.73
7.4.270.0070.00016.86
7.4.260.0040.00716.72
7.4.250.0050.00216.79
7.4.240.0000.00716.75
7.4.230.0040.00416.95
7.4.220.0170.00016.85
7.4.210.0090.00916.93
7.4.200.0050.00216.63
7.4.160.0090.00616.72
7.4.150.0120.00617.40
7.4.140.0080.01017.86
7.4.130.0110.00816.67
7.4.120.0090.00916.74
7.4.110.0100.00716.98
7.4.100.0110.00716.97
7.4.90.0070.01016.77
7.4.80.0100.01319.39
7.4.70.0090.00916.77
7.4.60.0100.00716.74
7.4.50.0080.00016.50
7.4.40.0040.01516.92
7.4.30.0060.01016.82
7.4.10.0040.01115.20
7.4.00.0050.01115.12
7.3.330.0050.00013.46
7.3.320.0060.00013.46
7.3.310.0030.00316.47
7.3.300.0070.00016.61
7.3.290.0140.00916.60
7.3.280.0100.00716.63
7.3.270.0090.00917.40
7.3.260.0150.00916.97
7.3.250.0130.00516.63
7.3.240.0060.01616.61
7.3.230.0130.00316.64
7.3.210.0100.00716.70
7.3.200.0170.00319.39
7.3.190.0090.00916.55
7.3.180.0110.00616.67
7.3.170.0140.00416.68
7.3.160.0100.01016.61
7.3.130.0060.01015.03
7.3.120.0070.00915.09
7.3.110.0180.00014.98
7.3.100.0130.00015.17
7.3.90.0040.00814.80
7.3.80.0030.01115.32
7.3.70.0040.00814.82
7.3.60.0090.00615.18
7.3.50.0060.00314.88
7.3.40.0080.00415.09
7.3.30.0060.01315.20
7.3.20.0070.01016.70
7.3.10.0080.00816.96
7.3.00.0070.00816.71
7.2.330.0120.00617.06
7.2.320.0070.01016.72
7.2.310.0070.01016.89
7.2.300.0130.00316.92
7.2.290.0060.00916.96
7.2.260.0070.01315.30
7.2.250.0070.01015.37
7.2.240.0110.00715.18
7.2.230.0100.00715.45
7.2.220.0130.00315.47
7.2.210.0030.00615.25
7.2.200.0040.01115.52
7.2.190.0090.00615.18
7.2.180.0060.00615.25
7.2.170.0080.00815.36
7.2.160.0030.01215.18
7.2.150.0070.01117.13
7.2.140.0060.01317.20
7.2.130.0150.00417.00
7.2.120.0090.00617.08
7.2.110.0070.01116.92
7.2.100.0080.00417.07
7.2.90.0050.00817.24
7.2.80.0040.00917.10
7.2.70.0110.00517.02
7.2.60.0060.01117.14
7.2.50.0100.00517.08
7.2.40.0090.01017.16
7.2.30.0120.00716.94
7.2.20.0120.00617.00
7.2.10.0100.00917.15
7.2.00.0070.00718.02
7.1.330.0100.00316.16
7.1.320.0140.00316.01
7.1.310.0040.00715.62
7.1.300.0070.00715.70
7.1.290.0060.00316.01
7.1.280.0080.00615.98
7.1.270.0070.01116.13
7.1.260.0060.00615.96
7.1.250.0110.00715.79
7.1.240.0030.01015.80
7.1.230.0060.00616.14
7.1.220.0030.00916.10
7.1.210.0080.00315.77
7.1.200.0060.00315.96
7.1.190.0060.00615.95
7.1.180.0040.01116.09
7.1.170.0030.01015.91
7.1.160.0060.01016.03
7.1.150.0040.00816.11
7.1.140.0040.01115.99
7.1.130.0060.00916.10
7.1.120.0040.01115.63
7.1.110.0030.00616.05
7.1.100.0050.00816.90
7.1.90.0140.00316.07
7.1.80.0060.01115.95
7.1.70.0030.00916.80
7.1.60.0070.00817.62
7.1.50.0110.00816.66
7.1.40.0080.00815.96
7.1.30.0110.00416.09
7.1.20.0080.00615.73
7.1.10.0030.00715.82
7.1.00.0060.04119.23
7.0.330.0070.00315.48
7.0.320.0030.01315.66
7.0.310.0030.00515.64
7.0.300.0000.01415.47
7.0.290.0060.00315.64
7.0.280.0030.01015.57
7.0.270.0000.01415.64
7.0.260.0100.00315.34
7.0.250.0070.00715.36
7.0.240.0040.01115.54
7.0.230.0100.00315.83
7.0.220.0070.00715.40
7.0.210.0080.00515.39
7.0.200.0030.01016.25
7.0.190.0070.00715.81
7.0.180.0060.00315.46
7.0.170.0070.00315.69
7.0.160.0080.00015.44
7.0.150.0040.00815.64
7.0.140.0010.04118.75
7.0.130.0000.00915.54
7.0.120.0070.01015.63
7.0.110.0130.00015.35
7.0.100.0070.00715.68
7.0.90.0030.01015.74
7.0.80.0030.01015.75
7.0.70.0060.00615.55
7.0.60.0040.05117.76
7.0.50.0070.03116.73
7.0.40.0100.04016.99
7.0.30.0170.02716.87
7.0.20.0080.04116.84
7.0.10.0060.03016.99
7.0.00.0100.02116.96
5.6.400.0060.00614.54
5.6.390.0110.00314.75
5.6.380.0030.01214.21
5.6.370.0120.00414.64
5.6.360.0030.00614.58
5.6.350.0000.01414.76
5.6.340.0090.00614.52
5.6.330.0090.00314.71
5.6.320.0090.00614.75
5.6.310.0040.01114.54
5.6.300.0100.00314.68
5.6.290.0040.01114.12
5.6.280.0070.04017.78
5.6.270.0100.00714.53
5.6.260.0040.00714.45
5.6.250.0060.00914.32
5.6.240.0120.00314.68
5.6.230.0030.00814.68
5.6.220.0070.00714.39
5.6.210.0130.03617.67
5.6.200.0130.03716.34
5.6.190.0080.04617.57
5.6.180.0130.03617.72
5.6.170.0180.04517.49
5.6.160.0050.04017.53
5.6.150.0070.04616.36
5.6.140.0040.02216.40
5.6.130.0030.03316.53
5.6.120.0060.02617.79
5.6.110.0120.04217.73
5.6.100.0060.04217.94
5.6.90.0070.04017.68
5.6.80.0080.04517.55
5.6.70.0030.00614.27
5.6.60.0060.00914.37
5.6.50.0000.01514.44
5.6.40.0090.00614.83
5.6.30.0040.01114.26
5.6.20.0070.00714.57
5.6.10.0000.01414.39
5.6.00.0040.01214.34
5.5.380.0040.01414.70
5.5.370.0030.01214.57
5.5.360.0030.01014.34
5.5.350.0080.03817.41
5.5.340.0090.03816.24
5.5.330.0030.02617.45
5.5.320.0030.03217.52
5.5.310.0140.04617.32
5.5.300.0020.02816.28
5.5.290.0080.03016.37
5.5.280.0050.03217.53
5.5.270.0100.04517.81
5.5.260.0060.04617.64
5.5.250.0120.03717.43
5.5.240.0200.03017.38
5.5.230.0060.00614.40
5.5.220.0070.00414.63
5.5.210.0060.00614.56
5.5.200.0030.00914.57
5.5.190.0000.00914.49
5.5.180.0040.01214.61
5.5.170.0060.00314.50
5.5.160.0000.01114.50
5.5.150.0090.00614.38
5.5.140.0060.01014.39
5.5.130.0130.00314.23
5.5.120.0030.00614.54
5.5.110.0070.00714.75
5.5.100.0110.00714.55
5.5.90.0000.01914.67
5.5.80.0080.00814.09
5.5.70.0030.01014.33
5.5.60.0040.01114.23
5.5.50.0000.01114.03
5.5.40.0090.00614.29
5.5.30.0090.00614.45
5.5.20.0030.00714.66
5.5.10.0090.00614.26
5.5.00.0120.00314.31
5.4.450.0370.02715.91
5.4.440.0200.02815.85
5.4.430.0300.02515.80
5.4.420.0280.02315.93
5.4.410.0270.02815.77
5.4.400.0170.02215.76
5.4.390.0160.01815.76
5.4.380.0170.03115.45
5.4.370.0250.04015.52
5.4.360.0280.03515.55
5.4.350.0260.03115.46
5.4.340.0230.03215.53
5.4.330.0000.00812.29
5.4.320.0080.02612.41
5.4.310.0070.02712.41
5.4.300.0040.02412.41
5.4.290.0070.02112.41
5.4.280.0090.02112.35
5.4.270.0020.02512.35
5.4.260.0040.02312.35
5.4.250.0070.02112.36
5.4.240.0080.02112.36
5.4.230.0060.02112.35
5.4.220.0040.02512.35
5.4.210.0020.02512.35
5.4.200.0080.01912.35
5.4.190.0060.02112.35
5.4.180.0050.02212.35
5.4.170.0080.02112.36
5.4.160.0040.02312.35
5.4.150.0080.01712.35
5.4.140.0050.02312.19
5.4.130.0070.02512.19
5.4.120.0050.02112.16
5.4.110.0050.02412.16
5.4.100.0060.02012.16
5.4.90.0100.02112.16
5.4.80.0050.01912.16
5.4.70.0060.02012.16
5.4.60.0060.02012.16
5.4.50.0040.02012.16
5.4.40.0070.01912.15
5.4.30.0050.02212.15
5.4.20.0080.02112.15
5.4.10.0040.02012.15
5.4.00.0060.02111.90
5.3.290.0070.02412.55
5.3.280.0060.02112.50
5.3.270.0040.02912.51
5.3.260.0060.02112.51
5.3.250.0020.02512.51
5.3.240.0070.02012.51
5.3.230.0030.02512.50
5.3.220.0030.02212.49
5.3.210.0050.02112.49
5.3.200.0050.02112.49
5.3.190.0040.02312.49
5.3.180.0040.02312.48
5.3.170.0040.02012.48
5.3.160.0070.02112.49
5.3.150.0050.02112.48
5.3.140.0070.02312.48
5.3.130.0120.01612.48
5.3.120.0040.02512.48
5.3.110.0040.02412.48
5.3.100.0020.02512.22
5.3.90.0030.02112.21
5.3.80.0060.02012.21
5.3.70.0070.02112.21
5.3.60.0080.02012.20
5.3.50.0050.01912.18
5.3.40.0030.02212.18
5.3.30.0060.02012.16
5.3.20.0050.02212.05
5.3.10.0040.02012.03
5.3.00.0040.02212.02
5.2.170.0070.0409.23
5.2.160.0070.0359.22
5.2.150.0060.0359.23
5.2.140.0030.0409.22
5.2.130.0070.0279.18
5.2.120.0080.0279.18
5.2.110.0050.0309.19
5.2.100.0040.0309.18
5.2.90.0050.0299.18
5.2.80.0070.0309.18
5.2.70.0040.0349.18
5.2.60.0050.0349.13
5.2.50.0060.0369.10
5.2.40.0080.0269.08
5.2.30.0030.0369.05
5.2.20.0060.0309.04
5.2.10.0070.0308.95
5.2.00.0070.0318.82
5.1.60.0060.0248.10
5.1.50.0050.0268.09
5.1.40.0040.0258.07
5.1.30.0080.0278.42
5.1.20.0040.0288.45
5.1.10.0070.0318.17
5.1.00.0070.0278.16
5.0.50.0050.0196.65
5.0.40.0060.0176.50
5.0.30.0040.0306.31
5.0.20.0070.0206.28
5.0.10.0060.0246.26
5.0.00.0060.0286.25
4.4.90.0050.0194.78
4.4.80.0040.0154.76
4.4.70.0030.0204.75
4.4.60.0060.0184.75
4.4.50.0060.0144.77
4.4.40.0030.0284.71
4.4.30.0050.0154.75
4.4.20.0040.0144.84
4.4.10.0030.0214.85
4.4.00.0020.0284.76
4.3.110.0030.0164.67
4.3.100.0050.0154.66
4.3.90.0040.0134.64
4.3.80.0040.0254.59
4.3.70.0000.0174.63
4.3.60.0030.0144.63
4.3.50.0010.0204.63
4.3.40.0020.0254.54
4.3.30.0030.0153.30
4.3.20.0020.0163.28
4.3.10.0020.0153.23
4.3.00.0000.02015.28

preferences:
40.95 ms | 401 KiB | 5 Q