3v4l.org

run code in 300+ PHP versions simultaneously
<?php function converTo($date, $format = 'Y-m-d', $default = null, callable $funcExc = null ) { if (empty($date)) { return $default; } if (!is_string($format)) { throw new \InvalidArgumentException("Неверный формат"); } try { if (!($date instanceof \DateTime)) { if (is_numeric($date) && ( strlen($timestamp) == 13 || strlen($timestamp) == 10 )) { $date = new \DateTime("@" . $date); } elseif (strtotime($date) !== false) { $date = new \DateTime("@" . strtotime($date)); } else { $date = new \DateTime($date); } } if(!($date = $date->format($format))) { throw new \InvalidArgumentException("Произошла ошибка при приведению к заданному формату: " . $format); } } catch (\Exception $e) { if ($funcExc !== null) { call_user_func($funcExc, $date); } throw $e; } return $date; } var_dump(converTo(['asda'])); die; abstract class T { static public $instanses; final private function __construct(){ } public static function getInstance() { if (!(static::$instanses instanceof static)) { static::$instanses = new static; } return static::$instanses; } } class A extends T { static public $instanses; } class B extends A { static public $instanses; } $t = A::getInstance(); var_dump($t); $t1 = B::getInstance(); var_dump($t1); new B(); ?>

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.00916.88
8.3.50.0070.00718.17
8.3.40.0060.00918.96
8.3.30.0080.00818.79
8.3.20.0000.00720.38
8.3.10.0040.00423.71
8.3.00.0040.00419.97
8.2.180.0030.01517.13
8.2.170.0040.01122.96
8.2.160.0140.00320.27
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0090.00019.14
8.2.120.0040.00426.35
8.2.110.0090.00020.38
8.2.100.0060.00617.91
8.2.90.0000.00819.09
8.2.80.0030.00517.97
8.2.70.0030.00617.59
8.2.60.0060.00317.93
8.2.50.0030.00618.07
8.2.40.0080.00020.98
8.2.30.0040.00420.68
8.2.20.0050.00317.87
8.2.10.0000.00818.11
8.2.00.0040.00418.09
8.1.280.0140.00725.92
8.1.270.0090.00620.38
8.1.260.0070.00328.09
8.1.250.0080.00028.09
8.1.240.0040.00823.86
8.1.230.0090.00321.10
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0080.00017.36
8.1.180.0040.00418.10
8.1.170.0080.00018.40
8.1.160.0000.00720.81
8.1.150.0040.00418.86
8.1.140.0040.00419.68
8.1.130.0000.00717.79
8.1.120.0000.00817.43
8.1.110.0000.00717.43
8.1.100.0000.00817.41
8.1.90.0000.00717.50
8.1.80.0000.00817.44
8.1.70.0030.00317.43
8.1.60.0030.00617.64
8.1.50.0030.00617.49
8.1.40.0000.00817.50
8.1.30.0100.00317.70
8.1.20.0030.00517.59
8.1.10.0070.00017.64
8.1.00.0040.00417.57
8.0.300.0070.00018.77
8.0.290.0020.00516.75
8.0.280.0000.00718.41
8.0.270.0030.00317.32
8.0.260.0030.00317.30
8.0.250.0040.00417.06
8.0.240.0030.00316.95
8.0.230.0000.00717.04
8.0.220.0040.00416.98
8.0.210.0040.00417.01
8.0.200.0000.00616.98
8.0.190.0000.00817.09
8.0.180.0000.00716.91
8.0.170.0040.00417.04
8.0.160.0030.00516.96
8.0.150.0090.00316.96
8.0.140.0000.00916.94
8.0.130.0060.00013.44
8.0.120.0030.00616.96
8.0.110.0000.00716.85
8.0.100.0040.00416.95
8.0.90.0030.00517.07
8.0.80.0070.01017.04
8.0.70.0030.00516.78
8.0.60.0040.00416.83
8.0.50.0000.00817.05
8.0.30.0120.00517.38
8.0.20.0140.00717.40
8.0.10.0030.00517.12
8.0.00.0090.01016.93
7.4.330.0000.00516.84
7.4.320.0050.00316.52
7.4.300.0000.00616.60
7.4.290.0080.00016.56
7.4.280.0030.00816.49
7.4.270.0060.00616.46
7.4.260.0030.00616.68
7.4.250.0030.00616.61
7.4.240.0000.00716.55
7.4.230.0030.00316.46
7.4.220.0060.01316.59
7.4.210.0160.00516.47
7.4.200.0030.00316.55
7.4.160.0040.01216.56
7.4.150.0080.01117.40
7.4.140.0150.00517.86
7.4.130.0090.01016.49
7.4.120.0080.00916.58
7.4.110.0140.00316.73
7.4.100.0130.00316.66
7.4.90.0090.00916.35
7.4.80.0060.01219.39
7.4.70.0120.00616.69
7.4.60.0080.00816.45
7.4.50.0030.01316.59
7.4.40.0130.00416.71
7.4.30.0060.01016.68
7.4.10.0030.01415.32
7.4.00.0060.01015.11
7.3.330.0000.00513.27
7.3.320.0000.00513.17
7.3.310.0050.00216.38
7.3.300.0030.00316.25
7.3.290.0030.00316.43
7.3.280.0090.00916.33
7.3.270.0110.00617.40
7.3.260.0130.00316.42
7.3.250.0080.01016.55
7.3.240.0050.01216.60
7.3.230.0190.00316.56
7.3.210.0100.00716.61
7.3.200.0090.00816.51
7.3.190.0130.01316.59
7.3.180.0080.00816.50
7.3.170.0110.00616.60
7.3.160.0090.00916.26
7.3.130.0030.01315.14
7.3.120.0040.00815.20
7.3.110.0030.01614.94
7.3.100.0120.00314.99
7.3.90.0070.00714.99
7.3.80.0060.00914.71
7.3.70.0040.00815.04
7.3.60.0060.00614.48
7.3.50.0110.00314.91
7.3.40.0040.01114.87
7.3.30.0060.00614.89
7.3.20.0040.00416.83
7.3.10.0090.00516.29
7.3.00.0090.00916.54
7.2.330.0030.01416.84
7.2.320.0100.00716.61
7.2.310.0070.01016.78
7.2.300.0070.01016.61
7.2.290.0060.01016.75
7.2.260.0070.01114.98
7.2.250.0070.01115.02
7.2.240.0100.00715.19
7.2.230.0090.00615.29
7.2.220.0090.00615.09
7.2.210.0100.00015.16
7.2.200.0030.01215.10
7.2.190.0110.00314.84
7.2.180.0120.00314.81
7.2.170.0070.01014.94
7.2.160.0090.00415.09
7.2.150.0100.00617.03
7.2.140.0040.01116.93
7.2.130.0080.00916.70
7.2.120.0150.00516.76
7.2.110.0060.00616.64
7.2.100.0100.00816.39
7.2.90.0110.00516.41
7.2.80.0120.00716.87
7.2.70.0070.01016.85
7.2.60.0100.00816.77
7.2.50.0090.00916.72
7.2.40.0130.00916.74
7.2.30.0130.00716.83
7.2.20.0080.01016.59
7.2.10.0080.01216.79
7.2.00.0080.01017.56
7.1.330.0070.00715.77
7.1.320.0030.01015.66
7.1.310.0000.01815.89
7.1.300.0100.00315.86
7.1.290.0050.00515.89
7.1.280.0000.01015.79
7.1.270.0030.00915.99
7.1.260.0090.00915.76
7.1.250.0070.01015.19
7.1.240.0090.00415.77
7.1.230.0070.00715.71
7.1.220.0090.00315.86
7.1.210.0030.00615.65
7.1.200.0030.01215.75
7.1.190.0100.00715.88
7.1.180.0090.00315.65
7.1.170.0070.00415.79
7.1.160.0120.00315.61
7.1.150.0070.00715.54
7.1.140.0030.00615.88
7.1.130.0000.01116.00
7.1.120.0060.00615.46
7.1.110.0040.00715.70
7.1.100.0030.01117.07
7.1.90.0110.00315.75
7.1.80.0030.01315.99
7.1.70.0080.00516.39
7.1.60.0050.01317.36
7.1.50.0090.00816.38
7.1.40.0100.00315.81
7.1.30.0100.00315.86
7.1.20.0030.00715.92
7.1.10.0100.00015.78
7.1.00.0070.03819.15
7.0.330.0070.00315.39
7.0.320.0100.00715.36
7.0.310.0030.01015.43
7.0.300.0040.00715.23
7.0.290.0130.00015.20
7.0.280.0060.00615.44
7.0.270.0090.00615.48
7.0.260.0090.00315.53
7.0.250.0060.00815.39
7.0.240.0030.01415.52
7.0.230.0070.00715.25
7.0.220.0000.01315.45
7.0.210.0120.00315.41
7.0.200.0080.00315.84
7.0.190.0070.00715.39
7.0.180.0070.00715.20
7.0.170.0060.00615.46
7.0.160.0030.00915.57
7.0.150.0000.01115.23
7.0.140.0000.00915.49
7.0.130.0030.01015.45
7.0.120.0060.00615.38
7.0.110.0030.00615.33
7.0.100.0040.00715.62
7.0.90.0090.00315.66
7.0.80.0060.00315.38
7.0.70.0110.00415.43
7.0.60.0050.03917.67
7.0.50.0020.03716.64
7.0.40.0020.02816.79
7.0.30.0180.02516.80
7.0.20.0220.03916.81
7.0.10.0070.05017.01
7.0.00.0020.04416.87
5.6.400.0050.00814.55
5.6.390.0000.01214.66
5.6.380.0090.00914.55
5.6.370.0070.00714.41
5.6.360.0030.01014.58
5.6.350.0070.00314.52
5.6.340.0060.00914.76
5.6.330.0000.01414.32
5.6.320.0030.01114.39
5.6.310.0110.00314.60
5.6.300.0040.01114.05
5.6.290.0060.00314.49
5.6.280.0030.04317.77
5.6.270.0070.00314.48
5.6.260.0050.00514.39
5.6.250.0070.00314.41
5.6.240.0070.00714.47
5.6.230.0030.00514.53
5.6.220.0030.01414.64
5.6.210.0070.04117.51
5.6.200.0020.03116.27
5.6.190.0080.02217.49
5.6.180.0170.03917.45
5.6.170.0130.03917.47
5.6.160.0030.03017.61
5.6.150.0030.02216.31
5.6.140.0040.02916.27
5.6.130.0070.02716.35
5.6.120.0050.04717.85
5.6.110.0050.02317.62
5.6.100.0050.04317.72
5.6.90.0130.03517.62
5.6.80.0070.03917.52
5.6.70.0060.00914.21
5.6.60.0040.00814.75
5.6.50.0000.01414.32
5.6.40.0000.00814.36
5.6.30.0060.01014.52
5.6.20.0060.01214.13
5.6.10.0000.01014.29
5.6.00.0060.01214.30
5.5.380.0030.00714.32
5.5.370.0070.00414.11
5.5.360.0080.01114.03
5.5.350.0150.04017.32
5.5.340.0070.04116.21
5.5.330.0030.02917.47
5.5.320.0180.04517.42
5.5.310.0100.04017.28
5.5.300.0070.03316.06
5.5.290.0080.04316.18
5.5.280.0090.01817.50
5.5.270.0050.04617.66
5.5.260.0050.03717.80
5.5.250.0000.04917.36
5.5.240.0100.04017.37
5.5.230.0060.00614.39
5.5.220.0030.01314.32
5.5.210.0090.00314.08
5.5.200.0000.00914.36
5.5.190.0130.00614.48
5.5.180.0030.01414.13
5.5.170.0120.00614.32
5.5.160.0100.00714.15
5.5.150.0000.01114.26
5.5.140.0040.00714.43
5.5.130.0000.00914.20
5.5.120.0090.00614.45
5.5.110.0100.00714.26
5.5.100.0120.00314.21
5.5.90.0060.01314.48
5.5.80.0090.00014.33
5.5.70.0040.01414.18
5.5.60.0110.00714.37
5.5.50.0070.00714.34
5.5.40.0000.01014.37
5.5.30.0080.00414.39
5.5.20.0090.00613.90
5.5.10.0030.00714.37
5.5.00.0080.00414.48

preferences:
67.73 ms | 400 KiB | 5 Q