3v4l.org

run code in 300+ PHP versions simultaneously
<?php function time_elapsed_string($datetime, $full = false) { $now = new DateTime; $ago = new DateTime($datetime); $diff = $now->diff($ago); $diff->w = floor($diff->d / 7); $diff->d -= $diff->w * 7; $periods = array( 'y' => ['jaar', 'jaren'], 'm' => ['maand', 'maanden'], 'w' => ['week', 'weken'], 'd' => ['dag', 'dagen'], 'h' => ['uur', 'uren'], 'i' => ['minuut', 'minuten'], 's' => ['seconde', 'seconden'] ); $parts = array(); foreach ($periods as $k => &$v) { if ($diff->$k) { $parts[] = $diff->$k . ' ' . $v[$diff->$k > 1]; } } if (!$full) $parts = array_slice($parts, 0, 1); return $parts ? implode(', ', $parts) . ' ago' : 'just now'; } echo time_elapsed_string('2020-03-21 00:30:16') . PHP_EOL; echo time_elapsed_string('2020-03-21 00:30:16', true) . PHP_EOL;

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.120.0100.00718.85
8.3.110.0170.00320.94
8.3.100.0100.01024.06
8.3.90.0080.00026.77
8.3.80.0030.00619.36
8.3.70.0040.01118.68
8.3.60.0070.01417.00
8.3.50.0140.00924.63
8.3.40.0100.01019.32
8.3.30.0060.01019.25
8.3.20.0070.00024.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.240.0050.00517.57
8.2.230.0030.00622.58
8.2.220.0060.00637.54
8.2.210.0050.00326.77
8.2.200.0090.00018.88
8.2.190.0130.00316.58
8.2.180.0110.01125.92
8.2.170.0110.00422.96
8.2.160.0100.01022.96
8.2.150.0050.00325.66
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0050.00321.09
8.2.110.0000.00921.00
8.2.100.0080.00418.16
8.2.90.0040.00418.28
8.2.80.0040.00420.52
8.2.70.0000.00818.00
8.2.60.0060.00318.00
8.2.50.0100.00019.18
8.2.40.0030.00521.19
8.2.30.0000.00819.33
8.2.20.0050.00218.13
8.2.10.0040.00419.46
8.2.00.0060.00319.35
8.1.300.0090.00620.18
8.1.290.0080.00430.84
8.1.280.0070.00725.92
8.1.270.0080.00023.99
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0060.00322.31
8.1.230.0060.00622.63
8.1.220.0000.00817.74
8.1.210.0040.00419.02
8.1.200.0000.00917.60
8.1.190.0000.00817.47
8.1.180.0000.00819.09
8.1.170.0050.00318.94
8.1.160.0040.00419.14
8.1.150.0000.00718.93
8.1.140.0000.00718.90
8.1.130.0030.00320.16
8.1.120.0000.00717.78
8.1.110.0030.00517.60
8.1.100.0040.00417.68
8.1.90.0040.00417.65
8.1.80.0000.00917.64
8.1.70.0000.00717.74
8.1.60.0080.00017.82
8.1.50.0000.00817.61
8.1.40.0000.00717.63
8.1.30.0040.00417.89
8.1.20.0000.00817.89
8.1.10.0050.00317.76
8.1.00.0000.00917.66
8.0.300.0080.00020.01
8.0.290.0050.00316.88
8.0.280.0030.00318.65
8.0.270.0000.00716.99
8.0.260.0000.00720.33
8.0.250.0030.00317.12
8.0.240.0030.00317.31
8.0.230.0040.00417.18
8.0.220.0050.00217.07
8.0.210.0000.00717.10
8.0.200.0030.00317.09
8.0.190.0050.00217.26
8.0.180.0000.00817.07
8.0.170.0030.00617.15
8.0.160.0070.00017.16
8.0.150.0000.00717.12
8.0.140.0040.00417.04
8.0.130.0000.00513.47
8.0.120.0050.00317.11
8.0.110.0020.00516.96
8.0.100.0050.00317.22
8.0.90.0090.00017.05
8.0.80.0080.00817.16
8.0.70.0030.00517.16
8.0.60.0080.00017.07
8.0.50.0050.00317.13
8.0.30.0150.00917.34
8.0.20.0160.00617.43
8.0.10.0040.00417.16
8.0.00.0040.01616.94
7.4.330.0060.00341.89
7.4.320.0070.00016.81
7.4.300.0060.00316.81
7.4.290.0080.00016.68
7.4.280.0060.00316.60
7.4.270.0000.00716.68
7.4.260.0070.00013.42
7.4.250.0020.00516.77
7.4.240.0030.00316.70
7.4.230.0000.00716.69
7.4.220.0060.00116.74
7.4.210.0080.00716.67
7.4.200.0000.00716.89
7.4.130.0100.00716.83
7.4.120.0100.01016.81
7.4.110.0090.00916.89
7.4.100.0130.00616.69
7.4.90.0100.00716.72
7.4.80.0150.00619.39
7.4.70.0100.00716.62
7.4.60.0080.01116.50
7.4.50.0110.00716.45
7.4.40.0090.00916.59
7.4.30.0110.01116.29
7.4.20.0110.00816.79
7.4.10.0100.00716.39
7.4.00.0070.01116.77
7.3.330.0000.00716.50
7.3.320.0060.00013.48
7.3.310.0000.00716.46
7.3.300.0030.00316.42
7.3.290.0060.01016.58
7.3.280.0120.00516.52
7.3.260.0060.01216.81
7.3.240.0120.00516.61
7.3.230.0080.00816.71
7.3.210.0070.01016.64
7.3.200.0130.01016.54
7.3.190.0120.00916.82
7.3.180.0130.00716.63
7.3.170.0090.00716.73
7.3.160.0090.00916.74
7.3.150.0030.01716.64
7.3.140.0120.00616.38
7.3.130.0170.00316.63
7.3.120.0140.00516.47
7.3.110.0040.01516.56
7.3.100.0070.01316.73
7.3.90.0110.00916.59
7.3.80.0150.00816.49
7.3.70.0060.01216.51
7.3.60.0110.00716.66
7.3.50.0140.00416.61
7.3.40.0070.01416.59
7.3.30.0120.01216.51
7.3.20.0100.01616.52
7.3.10.0190.00416.56
7.3.00.0200.00716.39
7.2.330.0030.01316.85
7.2.310.0160.00617.05
7.2.300.0060.01316.85
7.2.290.0180.00016.88
7.2.280.0050.01316.92
7.2.270.0030.01416.67
7.2.260.0120.00916.76
7.2.250.0120.00916.76
7.2.240.0100.01016.91
7.2.230.0190.00016.70
7.2.220.0120.00616.89
7.2.210.0060.01317.08
7.2.200.0180.00016.80
7.2.190.0090.00916.71
7.2.180.0100.01316.84
7.2.170.0070.01416.89
7.2.160.0130.01016.83
7.2.150.0160.00916.85
7.2.140.0180.01116.94
7.2.130.0110.01116.96
7.2.120.0180.00816.89
7.2.110.0070.01416.88
7.2.100.0120.00916.73
7.2.90.0130.01016.54
7.2.80.0320.00616.66
7.2.70.0180.00416.80
7.2.60.0170.00316.64
7.2.50.0090.01416.66
7.2.40.0150.00816.76
7.2.30.0100.01716.84
7.2.20.0110.01416.33
7.2.10.0130.01116.86
7.2.00.0140.00416.73

preferences:
30.67 ms | 403 KiB | 5 Q