3v4l.org

run code in 300+ PHP versions simultaneously
<?php $year=2021; $month=7; $day=5; $index=-1; $period='day'; // strtotime test $dateString = $year . "-" . $month . "-" . $day . " -" . $index . " " . $period; $timestamp1 = strtotime("{$year}-{$month}-{$day} -{$index} {$period}"); // DateTime test $dateStamp = new \DateTime("{$year}-{$month}-{$day}"); $dateStamp->modify("-{$index} {$period}"); $timestamp2 = $dateStamp->getTimeStamp(); echo $dateString . PHP_EOL; echo "strtotime: " . $timestamp1 . PHP_EOL; echo "DateTime: " . $timestamp2;

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.0070.00817.86
8.4.120.0140.00620.57
8.4.110.0130.00822.35
8.4.100.0170.00717.70
8.4.90.0140.00618.45
8.4.80.0120.00817.82
8.4.70.0070.00118.21
8.4.60.0080.01218.79
8.4.50.0120.00919.66
8.4.40.0130.00920.44
8.4.30.0100.00722.15
8.4.20.0070.01018.17
8.4.10.0090.00022.04
8.3.260.0110.00916.88
8.3.250.0130.00818.98
8.3.240.0100.00616.63
8.3.230.0050.00316.68
8.3.220.0070.00117.25
8.3.210.0130.00516.65
8.3.200.0040.00516.63
8.3.190.0120.00617.01
8.3.180.0090.00616.78
8.3.170.0130.00717.12
8.3.160.0030.01416.71
8.3.150.0100.01018.73
8.3.140.0040.01117.11
8.3.130.0150.00618.67
8.3.120.0040.01118.81
8.3.110.0050.00320.94
8.3.100.0090.00016.66
8.3.90.0050.00316.64
8.3.80.0070.00718.42
8.3.70.0120.00316.38
8.3.60.0140.00018.25
8.3.50.0110.00718.56
8.3.40.0070.00720.06
8.3.30.0070.00720.89
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0070.00820.52
8.2.280.0110.00818.43
8.2.270.0110.00717.17
8.2.260.0120.00319.12
8.2.250.0160.00316.88
8.2.240.0040.00419.11
8.2.230.0060.00322.58
8.2.220.0080.00024.06
8.2.210.0090.00026.77
8.2.200.0070.00418.29
8.2.190.0150.00016.58
8.2.180.0090.00916.63
8.2.170.0120.00318.96
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00421.06
8.2.110.0100.00022.30
8.2.100.0060.00618.16
8.2.90.0000.00818.15
8.2.80.0040.00417.97
8.2.70.0080.00417.88
8.2.60.0170.00317.61
8.2.50.0150.00417.54
8.2.40.0150.00217.67
8.2.30.0100.00717.66
8.2.20.0050.00917.67
8.2.10.0120.00517.63
8.2.00.0130.00417.83
8.1.330.0100.00821.86
8.1.320.0100.01016.41
8.1.310.0120.00616.79
8.1.300.0080.00017.78
8.1.290.0120.00018.88
8.1.280.0120.00625.92
8.1.270.0090.00020.59
8.1.260.0030.00626.35
8.1.250.0080.00028.09
8.1.240.0000.01021.30
8.1.230.0080.00421.03
8.1.220.0000.00917.91
8.1.210.0040.00418.88
8.1.200.0030.00617.35
8.1.190.0110.00617.25
8.1.180.0140.00317.37
8.1.170.0120.00417.29
8.1.160.0080.00817.33
8.1.150.0140.00417.46
8.1.140.0130.00417.42
8.1.130.0110.00617.51
8.1.120.0130.00517.45
8.1.110.0150.00117.41
8.1.100.0120.00517.29
8.1.90.0140.00317.37
8.1.80.0130.00417.58
8.1.70.0130.00417.45
8.1.60.0090.01017.53
8.1.50.0140.00417.45
8.1.40.0110.00717.54
8.1.30.0130.00617.54
8.1.20.0160.00217.58
8.1.10.0120.00717.50
8.1.00.0130.00517.32
8.0.300.0000.00720.05
8.0.290.0040.00416.84
8.0.280.0140.00416.83
8.0.270.0130.00416.67
8.0.260.0110.00716.79
8.0.250.0110.00616.88
8.0.240.0130.00416.99
8.0.230.0130.00416.83
8.0.220.0110.00516.66
8.0.210.0130.00416.74
8.0.200.0130.00416.78
8.0.190.0120.00616.90
8.0.180.0120.00516.75
8.0.170.0140.00316.86
8.0.160.0120.00516.76
8.0.150.0100.00716.81
8.0.140.0140.00416.82
8.0.130.0110.00616.78
8.0.120.0090.00816.63
8.0.110.0140.00316.79
8.0.100.0120.00616.71
8.0.90.0130.00416.61
8.0.80.0140.00316.83
8.0.70.0130.00516.79
8.0.60.0110.00616.82
8.0.50.0100.00716.69
8.0.30.0100.00716.79
8.0.20.0130.00516.83
8.0.10.0130.00316.92

preferences:
26.89 ms | 403 KiB | 5 Q