3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createFromInput(string $input, string $lang){ $inputFormat = ['en' => 'm/d/Y H:i:s', 'fr' => 'd/m/Y H:i:s', 'de' => 'd.m.Y H:i:s']; return DateTime::createFromFormat($inputFormat[$lang],$input); } $lang = 'en'; $input = '12/20/2022 10:20:20'; echo createFromInput($input, $lang)->format('Y-m-d H:i:s'); //2022-12-20 10:20:20 $lang = 'fr'; $input = '20/12/2022 10:20:20'; echo createFromInput($input, $lang)->format('Y-m-d H:i:s'); //2022-12-20 10:20:20

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.130.0050.00417.75
8.4.120.0060.00820.63
8.4.110.0110.01022.52
8.4.100.0100.00917.87
8.4.90.0110.00918.87
8.4.80.0050.00419.65
8.4.70.0060.00518.00
8.4.60.0090.01118.69
8.4.50.0130.00419.57
8.4.40.0100.01019.38
8.4.30.0130.00619.02
8.4.20.0190.00026.11
8.4.10.0090.00023.79
8.3.260.0160.00916.63
8.3.250.0100.00718.98
8.3.240.0110.00916.45
8.3.230.0130.00716.63
8.3.220.0100.00617.18
8.3.210.0090.00216.66
8.3.200.0040.00516.54
8.3.190.0040.00420.77
8.3.180.0130.00818.12
8.3.170.0100.00319.16
8.3.160.0120.00616.53
8.3.150.0100.01019.05
8.3.140.0040.01116.54
8.3.130.0040.01518.19
8.3.120.0030.00618.70
8.3.110.0080.01220.94
8.3.100.0040.00424.06
8.3.90.0070.01026.77
8.3.80.0070.00317.97
8.3.70.0160.00616.52
8.3.60.0070.01116.63
8.3.50.0190.00316.47
8.3.40.0100.01020.21
8.3.30.0130.00618.89
8.3.20.0080.00024.18
8.3.10.0040.00424.66
8.3.00.0030.00526.16
8.2.290.0090.00720.41
8.2.280.0130.00520.38
8.2.270.0120.00617.41
8.2.260.0100.00318.82
8.2.250.0030.00518.19
8.2.240.0060.00317.12
8.2.230.0030.00722.58
8.2.220.0060.00337.54
8.2.210.0120.01226.77
8.2.200.0030.00716.75
8.2.190.0120.00316.58
8.2.180.0040.01116.63
8.2.170.0140.00719.00
8.2.160.0070.00722.96
8.2.150.0000.00825.66
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0080.00026.16
8.2.110.0030.00720.28
8.2.100.0070.00418.03
8.2.90.0100.00017.75
8.2.80.0040.00419.05
8.2.70.0030.00617.88
8.2.60.0040.00418.05
8.2.50.0040.00418.05
8.2.40.0050.00320.00
8.2.30.0040.00418.19
8.2.20.0050.00319.35
8.2.10.0060.00919.50
8.2.00.0150.00317.74
8.1.330.0120.00520.10
8.1.320.0050.00616.04
8.1.310.0060.01318.28
8.1.300.0130.00618.31
8.1.290.0060.00330.84
8.1.280.0100.00325.92
8.1.270.0070.00024.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00322.00
8.1.230.0060.00617.75
8.1.220.0060.00317.74
8.1.210.0000.00818.77
8.1.200.0090.00017.25
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0000.00719.01
8.1.160.0040.00418.95
8.1.150.0000.00818.75
8.1.140.0150.00019.19
8.1.130.0180.00017.25
8.1.120.0130.00517.58
8.1.110.0060.01317.43
8.1.100.0100.01017.52
8.1.90.0150.00517.48
8.1.80.0150.00317.46
8.1.70.0150.00417.48
8.1.60.0220.00217.70
8.1.50.0140.00817.59
8.1.40.0110.01117.63
8.1.30.0160.00517.58
8.1.20.0170.00417.71
8.1.10.0150.00717.52
8.1.00.0120.00617.76
8.0.300.0040.00418.77
8.0.290.0060.00316.88
8.0.280.0030.00318.43
8.0.270.0060.00717.03
8.0.260.0050.01416.96
8.0.250.0190.00016.97
8.0.240.0080.01116.96
8.0.230.0140.00316.92
8.0.220.0140.00516.96
8.0.210.0130.00716.80
8.0.200.0180.00017.02
8.0.190.0100.01016.84
8.0.180.0140.00618.62
8.0.170.0100.00716.94
8.0.160.0060.01216.88
8.0.150.0060.01216.89
8.0.140.0130.00616.89
8.0.130.0140.00516.77
8.0.120.0130.00416.79
8.0.110.0150.00316.83
8.0.100.0060.01316.94
8.0.90.0060.01216.82
8.0.80.0160.00016.96
8.0.70.0190.00016.81
8.0.60.0090.00916.96
8.0.50.0180.00016.94
8.0.30.0140.00316.90
8.0.20.0070.01116.88
8.0.10.0160.00017.02

preferences:
30.81 ms | 403 KiB | 5 Q