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([])); 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.0150.00016.88
8.3.50.0110.00822.10
8.3.40.0000.01518.83
8.3.30.0120.00318.80
8.3.20.0040.00420.30
8.3.10.0050.00323.48
8.3.00.0040.00419.72
8.2.180.0120.00916.63
8.2.170.0090.00622.96
8.2.160.0160.00319.36
8.2.150.0100.00024.18
8.2.140.0040.00424.66
8.2.130.0060.00319.32
8.2.120.0080.00026.35
8.2.110.0100.00021.01
8.2.100.0040.00717.91
8.2.90.0000.00819.23
8.2.80.0070.00317.97
8.2.70.0080.00417.63
8.2.60.0000.00817.91
8.2.50.0030.00518.07
8.2.40.0080.00020.87
8.2.30.0040.00420.72
8.2.20.0070.00017.73
8.2.10.0050.00318.07
8.2.00.0030.00617.91
8.1.280.0190.00325.92
8.1.270.0080.01220.38
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0030.00620.99
8.1.230.0040.00717.45
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0030.00617.23
8.1.190.0050.00317.13
8.1.180.0000.00818.10
8.1.170.0040.00418.50
8.1.160.0050.00320.60
8.1.150.0040.00418.82
8.1.140.0050.00519.50
8.1.130.0000.00717.64
8.1.120.0040.00417.30
8.1.110.0070.00017.35
8.1.100.0000.00817.43
8.1.90.0000.00717.30
8.1.80.0000.00917.41
8.1.70.0040.00417.36
8.1.60.0000.00817.52
8.1.50.0030.00617.51
8.1.40.0030.00517.54
8.1.30.0070.00317.68
8.1.20.0030.00617.61
8.1.10.0040.00417.55
8.1.00.0060.00317.47
8.0.300.0040.00418.77
8.0.290.0000.00716.75
8.0.280.0000.00718.42
8.0.270.0040.00417.16
8.0.260.0030.00317.23
8.0.250.0070.00016.99
8.0.240.0060.00016.90
8.0.230.0040.00416.91
8.0.220.0000.00716.77
8.0.210.0070.00016.74
8.0.200.0030.00316.91
8.0.190.0080.00016.79
8.0.180.0090.00016.83
8.0.170.0030.00616.80
8.0.160.0030.00516.93
8.0.150.0030.00716.79
8.0.140.0050.00216.81
8.0.130.0030.00313.22
8.0.120.0050.00316.87
8.0.110.0050.00216.79
8.0.100.0040.00416.92
8.0.90.0070.00016.83
8.0.80.0200.00316.89
8.0.70.0000.00716.82
8.0.60.0040.00416.77
8.0.50.0070.00016.91
8.0.30.0110.00717.06
8.0.20.0070.01217.40
8.0.10.0040.00416.85
8.0.00.0100.00916.75
7.4.330.0000.00516.84
7.4.320.0050.00316.36
7.4.300.0030.00316.48
7.4.290.0040.00416.49
7.4.280.0060.00616.47
7.4.270.0030.00616.63
7.4.260.0000.00916.52
7.4.250.0070.00016.52
7.4.240.0020.00516.53
7.4.230.0070.00016.29
7.4.220.0180.00816.39
7.4.210.0110.00516.61
7.4.200.0070.00016.38
7.4.160.0120.00316.50
7.4.150.0180.00017.40
7.4.140.0130.01017.86
7.4.130.0080.01116.54
7.4.120.0110.00616.55
7.4.110.0130.00616.25
7.4.100.0100.00616.73
7.4.90.0100.00716.40
7.4.80.0060.01119.39
7.4.70.0090.00616.32
7.4.60.0060.01016.54
7.4.50.0000.01616.32
7.4.40.0030.01616.28
7.4.30.0030.01416.49
7.4.00.0100.00715.23
7.3.330.0000.00513.28
7.3.320.0030.00313.19
7.3.310.0000.00716.33
7.3.300.0000.00616.28
7.3.290.0000.00716.28
7.3.280.0080.01016.30
7.3.270.0030.01317.40
7.3.260.0100.01316.31
7.3.250.0090.00916.28
7.3.240.0080.01116.29
7.3.230.0100.01316.39
7.3.210.0080.01216.42
7.3.200.0060.00916.33
7.3.190.0140.00716.38
7.3.180.0170.00016.37
7.3.170.0080.00816.51
7.3.160.0100.00716.62
7.2.330.0120.00616.61
7.2.320.0130.00916.72
7.2.310.0080.00816.75
7.2.300.0030.01416.39
7.2.290.0100.00716.75
7.2.60.0040.00716.50
7.1.200.0060.00615.82
7.1.70.0000.00917.11
7.1.60.0070.01719.13
7.1.50.0110.01416.79
7.1.00.0030.07022.57
7.0.200.0000.00816.77
7.0.60.0070.08019.82
7.0.50.0030.06017.86
7.0.40.0070.09020.05
7.0.30.0500.07020.23
7.0.20.0330.07720.24
7.0.10.0100.06720.09
7.0.00.0170.06720.24
5.6.280.0070.03020.92
5.6.210.0100.03320.46
5.6.200.0170.06718.16
5.6.190.0030.04320.77
5.6.180.0270.07720.61
5.6.170.0170.04020.47
5.6.160.0170.04320.54
5.6.150.0030.04018.29
5.6.140.0000.04018.12
5.6.130.0070.08718.16
5.6.120.0030.08321.00
5.6.110.0330.06021.00
5.6.100.0100.07020.99
5.6.90.0070.08320.89
5.6.80.0100.07720.55
5.5.350.0170.08020.48
5.5.340.0070.08017.94
5.5.330.0130.07720.28
5.5.320.0230.06720.24
5.5.310.0270.06020.34
5.5.300.0000.04718.05
5.5.290.0070.05017.94
5.5.280.0070.06020.89
5.5.270.0130.03320.81
5.5.260.0070.04720.97
5.5.250.0030.08720.70
5.5.240.0300.06020.25

preferences:
42.5 ms | 401 KiB | 5 Q