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 (is_string($date) && (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.40.0070.00718.83
8.3.30.0070.00718.79
8.3.20.0040.00420.39
8.3.10.0000.00823.65
8.3.00.0040.00419.85
8.2.170.0150.00022.96
8.2.160.0100.00720.38
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00419.32
8.2.120.0030.00626.35
8.2.110.0070.00320.38
8.2.100.0040.00817.93
8.2.90.0000.00819.17
8.2.80.0080.00017.97
8.2.70.0080.00017.75
8.2.60.0000.00917.80
8.2.50.0000.00818.07
8.2.40.0000.00821.07
8.2.30.0030.00320.57
8.2.20.0070.00018.03
8.2.10.0040.00417.98
8.2.00.0040.00418.15
8.1.270.0060.00320.45
8.1.260.0070.00428.09
8.1.250.0090.00028.09
8.1.240.0040.00422.14
8.1.230.0090.00319.27
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0030.00617.48
8.1.190.0000.00817.25
8.1.180.0040.00418.10
8.1.170.0040.00418.45
8.1.160.0030.00620.88
8.1.150.0040.00418.85
8.1.140.0000.00819.60
8.1.130.0000.00717.66
8.1.120.0070.00017.55
8.1.110.0040.00417.41
8.1.100.0000.00817.55
8.1.90.0040.00417.49
8.1.80.0000.00817.48
8.1.70.0030.00317.42
8.1.60.0000.00817.67
8.1.50.0040.00417.47
8.1.40.0040.00417.55
8.1.30.0070.00317.75
8.1.20.0000.00817.62
8.1.10.0000.00817.54
8.1.00.0050.00217.55
8.0.300.0020.00518.77
8.0.290.0040.00417.00
8.0.280.0000.00718.49
8.0.270.0070.00017.25
8.0.260.0030.00317.23
8.0.250.0000.00717.03
8.0.240.0000.00717.04
8.0.230.0030.00317.14
8.0.220.0040.00417.04
8.0.210.0040.00417.03
8.0.200.0000.00717.12
8.0.190.0040.00417.17
8.0.180.0070.00017.06
8.0.170.0040.00417.09
8.0.160.0030.00617.07
8.0.150.0000.01017.03
8.0.140.0000.00716.93
8.0.130.0030.00313.53
8.0.120.0060.00317.06
8.0.110.0040.00416.89
8.0.100.0040.00416.93
8.0.90.0000.00716.98
8.0.80.0030.01217.04
8.0.70.0040.00416.89
8.0.60.0040.00416.92
8.0.50.0040.00416.93
8.0.30.0090.01017.21
8.0.20.0120.00717.44
8.0.10.0040.00417.30
8.0.00.0140.00716.93
7.4.330.0000.00516.89
7.4.320.0000.00616.70
7.4.300.0060.00016.66
7.4.290.0070.00016.64
7.4.280.0040.00716.66
7.4.270.0060.00616.63
7.4.260.0030.00616.64
7.4.250.0040.00416.50
7.4.240.0030.00316.55
7.4.230.0000.00816.60
7.4.220.0120.01216.68
7.4.210.0080.01216.59
7.4.200.0000.00716.35
7.4.160.0060.00916.46
7.4.150.0090.00917.40
7.4.140.0100.00917.86
7.4.130.0100.01216.70
7.4.120.0100.00916.52
7.4.110.0070.01016.65
7.4.100.0130.00316.42
7.4.90.0110.00616.63
7.4.80.0030.01519.39
7.4.70.0140.00616.76
7.4.60.0140.00416.63
7.4.50.0070.00716.57
7.4.40.0040.01216.55
7.4.30.0070.01116.65
7.4.00.0070.01014.88
7.3.330.0060.00013.34
7.3.320.0000.00513.13
7.3.310.0030.00316.28
7.3.300.0030.00316.38
7.3.290.0000.00716.35
7.3.280.0070.01216.31
7.3.270.0030.01317.40
7.3.260.0170.00016.78
7.3.250.0080.01216.44
7.3.240.0120.00516.53
7.3.230.0100.01316.40
7.3.210.0100.00716.35
7.3.200.0110.01016.44
7.3.190.0120.00716.63
7.3.180.0090.00916.45
7.3.170.0110.01116.51
7.3.160.0080.00816.43
7.3.120.0090.00914.51
7.3.110.0090.00614.92
7.3.100.0110.00814.79
7.3.90.0040.00814.82
7.3.80.0100.01014.85
7.3.70.0070.01114.73
7.3.60.0000.01614.63
7.3.50.0030.01314.61
7.3.40.0130.00314.82
7.3.30.0090.00614.89
7.3.20.0100.00316.37
7.3.10.0130.00316.70
7.3.00.0100.00316.52
7.2.330.0110.00716.79
7.2.320.0090.00916.41
7.2.310.0130.00316.47
7.2.300.0040.01416.63
7.2.290.0120.00616.49
7.2.250.0060.01114.50
7.2.240.0110.00914.90
7.2.230.0090.01114.73
7.2.220.0110.00714.56
7.2.210.0070.01314.57
7.2.200.0070.01114.70
7.2.190.0060.00914.60
7.2.180.0030.00914.48
7.2.170.0060.00814.59
7.2.80.0030.00916.79
7.2.60.0060.01016.82
7.2.00.0000.01119.54
7.1.330.0050.00815.74
7.1.320.0030.00715.84
7.1.310.0030.01215.90
7.1.300.0040.00415.61
7.1.290.0060.00615.66
7.1.280.0030.01215.57
7.1.270.0080.00815.67
7.1.260.0060.00915.30
7.1.200.0050.00815.71
7.1.100.0120.00418.08
7.1.70.0050.00317.23
7.1.60.0070.01719.13
7.1.50.0070.01616.94
7.1.00.0000.08022.54
7.0.200.0080.00416.80
7.0.60.0130.07320.04
7.0.50.0030.08317.83
7.0.40.0130.08020.13
7.0.30.0430.07320.10
7.0.20.0300.08020.25
7.0.10.0130.08320.22
7.0.00.0170.07720.17
5.6.280.0000.05020.88
5.6.210.0070.03720.74
5.6.200.0030.08718.28
5.6.190.0030.04320.33
5.6.180.0300.08020.47
5.6.170.0130.04320.71
5.6.160.0070.06020.43
5.6.150.0070.03718.18
5.6.140.0000.04318.28
5.6.130.0070.06718.19
5.6.120.0100.06021.04
5.6.110.0170.07321.02
5.6.100.0070.03721.11
5.6.90.0100.05721.09
5.6.80.0200.05320.54
5.5.350.0130.08020.51
5.5.340.0070.08017.92
5.5.330.0100.08020.25
5.5.320.0200.08020.39
5.5.310.0230.03320.24
5.5.300.0130.05717.96
5.5.290.0070.05717.98
5.5.280.0100.03720.71
5.5.270.0070.08720.88
5.5.260.0070.05720.91
5.5.250.0030.08020.70
5.5.240.0270.06320.29

preferences:
53.25 ms | 400 KiB | 5 Q