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('asdgfe')); 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.70.0070.01118.81
8.3.60.0080.00817.00
8.3.50.0090.00922.13
8.3.40.0090.00618.84
8.3.30.0090.00618.96
8.3.20.0040.00420.20
8.3.10.0050.00223.36
8.3.00.0000.00819.97
8.2.190.0090.00916.75
8.2.180.0070.01117.13
8.2.170.0120.00322.96
8.2.160.0160.00019.42
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0030.00619.27
8.2.120.0040.00426.35
8.2.110.0030.00620.39
8.2.100.0090.00318.09
8.2.90.0050.00319.21
8.2.80.0080.00017.97
8.2.70.0000.01017.86
8.2.60.0040.00418.05
8.2.50.0080.00018.07
8.2.40.0050.00320.97
8.2.30.0000.00720.69
8.2.20.0070.00017.84
8.2.10.0000.00818.29
8.2.00.0040.00418.32
8.1.280.0160.00625.92
8.1.270.0100.00720.30
8.1.260.0030.00628.09
8.1.250.0040.00428.09
8.1.240.0030.00622.27
8.1.230.0080.00417.82
8.1.220.0000.00817.91
8.1.210.0000.00818.77
8.1.200.0060.00317.73
8.1.190.0090.00017.50
8.1.180.0000.00818.10
8.1.170.0080.00018.74
8.1.160.0000.00720.89
8.1.150.0050.00318.92
8.1.140.0040.00419.62
8.1.130.0050.00317.80
8.1.120.0080.00017.62
8.1.110.0000.00717.75
8.1.100.0040.00417.64
8.1.90.0030.00517.70
8.1.80.0000.00817.71
8.1.70.0030.00517.62
8.1.60.0050.00317.68
8.1.50.0000.00917.71
8.1.40.0090.00017.66
8.1.30.0070.00317.74
8.1.20.0000.00717.88
8.1.10.0030.00617.81
8.1.00.0000.00917.77
8.0.300.0000.00718.77
8.0.290.0040.00417.00
8.0.280.0070.00018.54
8.0.270.0040.00417.34
8.0.260.0030.00517.39
8.0.250.0030.00517.21
8.0.240.0000.00717.20
8.0.230.0000.00717.10
8.0.220.0000.00717.02
8.0.210.0030.00517.13
8.0.200.0030.00317.23
8.0.190.0090.00017.20
8.0.180.0070.00017.14
8.0.170.0030.00517.13
8.0.160.0030.00517.13
8.0.150.0080.00417.09
8.0.140.0080.00016.99
8.0.130.0030.00313.50
8.0.120.0060.00317.18
8.0.110.0080.00017.04
8.0.100.0000.00816.99
8.0.90.0070.00017.00
8.0.80.0100.00717.19
8.0.70.0050.00317.21
8.0.60.0040.00416.98
8.0.50.0000.00716.97
8.0.30.0120.00617.44
8.0.20.0120.00817.40
8.0.10.0060.00317.23
8.0.00.0130.00516.85
7.4.330.0050.00016.79
7.4.320.0040.00416.82
7.4.300.0030.00316.60
7.4.290.0050.00316.79
7.4.280.0030.00716.69
7.4.270.0000.00816.64
7.4.260.0080.00416.73
7.4.250.0040.00416.67
7.4.240.0070.00016.76
7.4.230.0050.00216.69
7.4.220.0140.00816.73
7.4.210.0090.00916.73
7.4.200.0080.00016.85
7.4.160.0090.00616.61
7.4.150.0060.01317.40
7.4.140.0130.01117.86
7.4.130.0120.00816.66
7.4.120.0080.00916.71
7.4.110.0000.01816.81
7.4.100.0040.01316.70
7.4.90.0100.00716.85
7.4.80.0070.01119.39
7.4.70.0130.00316.89
7.4.60.0040.01516.84
7.4.50.0060.00616.45
7.4.40.0090.00916.56
7.4.30.0100.01016.48
7.4.00.0120.00715.30
7.3.330.0030.00313.41
7.3.320.0060.00013.44
7.3.310.0070.00016.45
7.3.300.0000.00716.64
7.3.290.0030.00316.66
7.3.280.0120.00616.59
7.3.270.0080.00917.40
7.3.260.0130.00316.69
7.3.250.0100.01216.64
7.3.240.0120.00716.59
7.3.230.0090.01216.69
7.3.210.0100.00716.80
7.3.200.0030.01316.58
7.3.190.0040.01816.71
7.3.180.0070.01016.46
7.3.170.0120.00916.62
7.3.160.0100.00716.56
7.3.120.0060.01015.30
7.3.110.0070.00715.24
7.3.100.0070.00714.93
7.3.90.0040.00815.29
7.3.80.0090.00615.02
7.3.70.0000.00815.14
7.3.60.0060.00914.96
7.3.50.0070.00314.96
7.3.40.0070.00715.12
7.3.30.0060.00314.88
7.3.20.0090.00616.93
7.3.10.0090.00917.02
7.3.00.0000.01416.95
7.2.330.0130.01017.01
7.2.320.0030.01317.05
7.2.310.0110.00616.89
7.2.300.0030.01516.80
7.2.290.0130.00317.00
7.2.250.0100.01014.97
7.2.240.0090.00914.95
7.2.230.0000.01315.10
7.2.220.0060.00615.29
7.2.210.0070.00715.47
7.2.200.0030.01015.31
7.2.190.0060.00614.81
7.2.180.0070.00715.30
7.2.170.0040.01115.19
7.2.80.0030.00616.67
7.2.60.0090.00616.94
7.2.00.0040.01119.70
7.1.330.0060.00916.01
7.1.320.0040.01116.09
7.1.310.0060.01115.91
7.1.300.0030.01015.93
7.1.290.0030.01016.02
7.1.280.0000.01616.08
7.1.270.0060.00315.66
7.1.260.0000.01415.80
7.1.200.0130.00715.39
7.1.100.0030.00918.43
7.1.70.0080.00017.31
7.1.60.0110.01519.13
7.1.50.0040.01817.16
7.1.00.0100.07022.46
7.0.200.0000.00816.99
7.0.60.0170.06020.03
7.0.50.0070.08717.89
7.0.40.0030.04720.04
7.0.30.0370.06020.12
7.0.20.0270.08320.13
7.0.10.0070.05720.06
7.0.00.0070.05720.32
5.6.280.0130.06021.08
5.6.210.0170.07320.56
5.6.200.0130.06718.16
5.6.190.0030.04320.61
5.6.180.0300.05020.55
5.6.170.0100.04720.55
5.6.160.0170.03020.46
5.6.150.0100.03318.15
5.6.140.0100.06318.24
5.6.130.0130.08018.19
5.6.120.0200.07721.13
5.6.110.0030.04721.15
5.6.100.0100.08021.14
5.6.90.0070.09321.11
5.6.80.0030.08020.45
5.5.350.0170.07720.49
5.5.340.0070.05717.94
5.5.330.0070.04320.37
5.5.320.0300.07320.33
5.5.310.0230.06020.42
5.5.300.0100.08017.93
5.5.290.0000.08717.97
5.5.280.0130.03020.91
5.5.270.0100.05020.86
5.5.260.0030.08720.69
5.5.250.0000.08320.72
5.5.240.0170.07320.21

preferences:
50.09 ms | 401 KiB | 5 Q