3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DateTimeType { private const FORMAT = 'Y-m-d H:i:s'; private const TIMEZONE = 'Europe/Berlin'; public static function isValidDateTimeOld(string $value): bool { $date = DateTime::createFromFormat(self::FORMAT, $value, new DateTimeZone(self::TIMEZONE)); $errors = DateTime::getLastErrors(); return $date && $errors['warning_count'] === 0 && $errors['error_count'] === 0; } public static function isValidDateTimeNew(string $value): bool { $date = DateTime::createFromFormat(self::FORMAT, $value, new DateTimeZone(self::TIMEZONE)); $errors = DateTime::getLastErrors(); return $date && !$errors; } } $dateTimeToCheck = '2022-02-17 13:37:00'; var_dump(DateTimeType::isValidDateTimeOld($dateTimeToCheck)); var_dump(DateTimeType::isValidDateTimeNew($dateTimeToCheck));

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.4.120.0110.00922.51
8.4.110.0160.00622.71
8.4.100.0100.00920.81
8.4.90.0040.00520.57
8.4.80.0090.01118.24
8.4.70.0070.01118.45
8.4.60.0140.00718.82
8.4.50.0100.01118.63
8.4.40.0160.00319.89
8.4.30.0200.00020.63
8.4.20.0070.01318.11
8.4.10.0080.00018.81
8.3.250.0100.01019.05
8.3.240.0060.00418.88
8.3.230.0120.00916.84
8.3.220.0090.01117.43
8.3.210.0110.00818.71
8.3.200.0050.00416.89
8.3.190.0080.00817.17
8.3.180.0090.00916.75
8.3.170.0130.00618.89
8.3.160.0150.00317.35
8.3.150.0060.00317.36
8.3.140.0040.00416.67
8.3.130.0040.00416.79
8.3.120.0110.00718.93
8.3.110.0040.00420.94
8.3.100.0070.00724.06
8.3.90.0070.00726.77
8.3.80.0030.00616.88
8.3.70.0130.00316.63
8.3.60.0150.00316.63
8.3.50.0100.01020.48
8.3.40.0070.01319.34
8.3.30.0100.00318.79
8.3.20.0060.00324.18
8.3.10.0000.00724.66
8.3.00.0000.00826.16
8.2.290.0080.01220.40
8.2.280.0060.00318.65
8.2.270.0090.01217.19
8.2.260.0100.00018.43
8.2.250.0130.00918.53
8.2.240.0060.00319.02
8.2.230.0090.00022.58
8.2.220.0030.00637.54
8.2.210.0070.00026.77
8.2.200.0030.00616.88
8.2.190.0070.00718.54
8.2.180.0090.00925.92
8.2.170.0120.00319.02
8.2.160.0130.00022.96
8.2.150.0070.00025.66
8.2.140.0070.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00426.16
8.2.110.0100.00022.31
8.2.100.0090.00317.97
8.2.90.0030.00618.00
8.2.80.0060.00318.05
8.2.70.0100.00017.75
8.2.60.0040.00417.88
8.2.50.0000.00817.98
8.2.40.0000.00818.00
8.2.30.0040.00418.06
8.2.20.0000.00820.31
8.2.10.0070.00017.89
8.2.00.0040.00419.25
8.1.330.0100.00821.75
8.1.320.0160.00516.31
8.1.310.0090.00018.56
8.1.300.0030.00616.88
8.1.290.0000.00918.88
8.1.280.0080.00825.92
8.1.270.0080.00023.99
8.1.260.0080.00026.35
8.1.250.0030.00628.09
8.1.240.0030.00622.19
8.1.230.0110.00020.88
8.1.220.0000.00817.79
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0040.00417.35
8.1.180.0030.00518.10
8.1.170.0080.00017.62
8.1.160.0000.00820.26
8.1.150.0050.00218.63
8.1.140.0040.00417.49
8.1.130.0000.00718.96
8.1.120.0040.00417.52
8.1.110.0050.00317.53
8.1.100.0060.00317.62
8.1.90.0030.00517.59
8.1.80.0000.00717.55
8.1.70.0040.00417.64
8.1.60.0000.00817.66
8.1.50.0030.00517.57
8.1.40.0020.00517.50
8.1.30.0050.00817.65
8.1.20.0080.00517.59
8.1.10.0030.01017.50
8.1.00.0080.00617.55
8.0.300.0000.00819.94
8.0.290.0040.00416.74
8.0.280.0000.00718.39
8.0.270.0000.00716.88
8.0.260.0030.00318.52
8.0.250.0000.00817.03
8.0.240.0060.00317.16
8.0.230.0070.00317.06
8.0.220.0040.00416.96
8.0.210.0030.00317.09
8.0.200.0000.00717.10
8.0.190.0040.00417.18
8.0.180.0000.00817.06
8.0.170.0030.00517.10
8.0.160.0140.00317.12
8.0.150.0150.00417.05
8.0.140.0150.00417.04
8.0.130.0190.00016.86
8.0.120.0170.00317.04
8.0.110.0110.01017.00
8.0.100.0120.00616.87
8.0.90.0160.00317.04
8.0.80.0130.00617.08
8.0.70.0160.00217.04
8.0.60.0140.00516.91
8.0.50.0120.00816.95
8.0.30.0230.00016.98
8.0.20.0120.00817.04
8.0.10.0200.00017.08
7.4.330.0050.00015.55
7.4.320.0040.00416.57
7.4.300.0030.00316.46
7.4.290.0030.00716.54
7.4.280.0070.00016.51
7.4.270.0100.01016.49
7.4.260.0240.00016.55
7.4.250.0200.00416.54
7.4.240.0200.00316.54
7.4.230.0170.00516.63
7.4.220.0200.00016.61
7.4.210.0100.01016.43
7.4.200.0210.00016.52
7.4.190.0140.00316.58
7.4.180.0100.00516.67
7.4.160.0140.00316.60
7.4.150.0160.00316.54
7.4.140.0170.00016.32
7.4.130.0130.00716.50
7.4.120.0060.01216.59
7.4.110.0090.00916.46
7.4.100.0150.00316.46
7.4.90.0110.00716.55
7.4.80.0180.00016.52
7.4.70.0140.00416.58
7.4.60.0040.00816.50
7.4.50.0060.00616.44
7.4.40.0080.00416.31
7.4.30.0050.01016.36
7.4.20.0050.00516.49
7.4.10.0050.00516.39
7.4.00.0050.00516.41

preferences:
109.5 ms | 403 KiB | 5 Q