3v4l.org

run code in 300+ PHP versions simultaneously
<?php $datetimes = [ '2003-01-28 01:23:45', '2007-04-04', '0000-00-00 00:00:00', '0000-00-00', '', null ]; foreach ($datetimes as $datetime) { sscanf($datetime, '%s', $sscanf); var_export( [ 'substr' => substr($datetime, 0, 10), 'explode' => explode(' ', $datetime, 2)[0], 'sscanf' => $sscanf, 'preg_replace' => preg_replace('/ .+/', '', $datetime), 'format' => (new \DateTime($datetime))->format('Y-m-d'), 'date&strtotime' => date("Y-m-d", strtotime($datetime)), 'strtok' => strtok($datetime, ' '), 'strstr' => strstr($datetime . ' ', ' ', true), ] ); unset($sscanf); echo "\n---\n"; }

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.0120.00920.66
8.4.110.0120.00518.85
8.4.100.0130.00818.18
8.4.90.0140.00818.49
8.4.80.0110.00522.36
8.4.70.0100.01118.23
8.4.60.0110.01018.85
8.4.50.0040.00718.33
8.4.40.0150.00420.30
8.4.30.0060.00320.53
8.4.20.0140.00720.59
8.4.10.0060.00318.33
8.3.250.0100.00919.21
8.3.240.0060.01016.95
8.3.230.0100.01116.94
8.3.220.0100.00917.34
8.3.210.0110.01016.88
8.3.200.0050.00417.02
8.3.190.0140.00617.17
8.3.180.0030.00518.74
8.3.170.0130.00318.98
8.3.160.0040.01118.73
8.3.150.0180.00020.86
8.3.140.0030.01317.19
8.3.130.0080.00018.98
8.3.120.0130.00618.95
8.3.110.0060.00320.94
8.3.100.0060.00324.06
8.3.90.0030.00726.77
8.3.80.0080.00417.13
8.3.70.0210.00017.00
8.3.60.0000.01517.13
8.3.50.0100.01018.52
8.3.40.0060.01019.18
8.3.30.0040.01519.25
8.3.20.0060.00324.18
8.3.10.0030.00524.66
8.3.00.0000.00826.16
8.2.290.0040.00720.44
8.2.280.0070.00220.83
8.2.270.0040.00418.85
8.2.260.0040.00418.67
8.2.250.0050.00316.96
8.2.240.0060.00317.41
8.2.230.0090.00022.58
8.2.220.0070.00337.54
8.2.210.0060.00326.77
8.2.200.0060.00317.13
8.2.190.0170.00317.00
8.2.180.0130.00625.92
8.2.170.0090.00619.29
8.2.160.0060.00922.96
8.2.150.0050.00325.66
8.2.140.0000.00824.66
8.2.130.0030.00526.16
8.2.120.0030.00619.04
8.2.110.0030.00620.59
8.2.100.0120.00018.09
8.2.90.0050.00318.13
8.2.80.0060.00819.12
8.2.70.0030.00617.93
8.2.60.0040.00418.13
8.2.50.0040.00418.13
8.2.40.0030.00619.73
8.2.30.0040.00418.13
8.2.20.0030.00618.29
8.2.10.0090.00021.00
8.2.00.0070.00019.49
8.1.330.0130.00616.73
8.1.320.0110.00816.58
8.1.310.0050.00317.06
8.1.300.0080.00818.33
8.1.290.0030.00618.88
8.1.280.0110.00725.92
8.1.270.0070.00722.05
8.1.260.0000.00926.35
8.1.250.0070.00028.09
8.1.240.0130.00022.07
8.1.230.0040.00722.82
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0000.00917.73
8.1.190.0040.00417.48
8.1.180.0080.00018.10
8.1.170.0040.00417.65
8.1.160.0070.00018.88
8.1.150.0000.00818.88
8.1.140.0040.00418.95
8.1.130.0050.00217.69
8.1.120.0040.00417.75
8.1.110.0050.00317.79
8.1.100.0040.00417.88
8.1.90.0000.00717.86
8.1.80.0000.00917.74
8.1.70.0000.00717.86
8.1.60.0000.00817.85
8.1.50.0030.00517.85
8.1.40.0100.00017.80
8.1.30.0050.00318.02
8.1.20.0040.00417.97
8.1.10.0000.00817.91
8.1.00.0000.00917.90
8.0.300.0050.00320.79
8.0.290.0070.00017.13
8.0.280.0050.00318.38
8.0.270.0000.00717.12
8.0.260.0070.00017.25
8.0.250.0000.00717.32
8.0.240.0030.00517.32
8.0.230.0040.00417.21
8.0.220.0000.00817.27
8.0.210.0000.00717.16
8.0.200.0000.00717.20
8.0.190.0030.00517.37
8.0.180.0040.00417.26
8.0.170.0030.00517.32
8.0.160.0000.00817.28
8.0.150.0050.00317.18
8.0.140.0070.00017.18
8.0.130.0000.00613.64
8.0.120.0030.00517.11
8.0.110.0080.00017.23
8.0.100.0040.00417.15
8.0.90.0080.00017.25
8.0.80.0000.00717.10
8.0.70.0040.00417.27
8.0.60.0040.00417.14
8.0.50.0050.00217.25
8.0.30.0000.00817.30
8.0.20.0070.00017.27
8.0.10.0040.00417.43
8.0.00.0040.00417.37
7.4.330.0050.00015.55
7.4.320.0000.00616.99
7.4.300.0030.00316.97
7.4.290.0070.00016.74
7.4.280.0050.00316.82
7.4.270.0000.00816.88
7.4.260.0030.00313.57
7.4.250.0050.00216.86
7.4.240.0050.00517.03
7.4.230.0000.00717.09
7.4.220.0070.00016.85
7.4.210.0000.00717.04
7.4.200.0050.00217.03
7.4.190.0030.00316.95
7.4.180.0050.00217.06
7.4.160.0030.00316.75
7.4.150.0030.00316.71
7.4.140.0030.00317.08
7.4.130.0070.00017.08
7.4.120.0050.00317.00
7.4.110.0080.00016.95
7.4.100.0030.00316.71
7.4.90.0030.00316.86
7.4.80.0030.00517.00
7.4.70.0000.00816.76
7.4.60.0030.00316.98
7.4.50.0030.00316.84
7.4.40.0000.00716.69
7.4.30.0070.00016.63
7.4.20.0030.00316.73
7.4.10.0040.00416.86
7.4.00.0040.00416.93
7.3.330.0000.00716.51
7.3.320.0050.00013.50
7.3.310.0030.00316.47
7.3.300.0030.00316.54
7.3.290.0000.00716.65
7.3.280.0000.00716.65
7.3.270.0000.00716.62
7.3.260.0050.00216.68
7.3.250.0030.00316.69
7.3.240.0050.00216.71
7.3.230.0000.00816.67
7.3.220.0030.00316.65
7.3.210.0000.00616.67
7.3.200.0040.00416.59
7.3.190.0030.00316.66
7.3.180.0000.00716.67
7.3.170.0030.00316.53
7.3.160.0040.00416.46
7.3.150.0030.00316.48
7.3.140.0030.00316.45
7.3.130.0070.00016.63
7.3.120.0050.00216.64
7.3.110.0040.00416.47
7.3.100.0000.00716.59
7.3.90.0030.00316.85
7.3.80.0060.00016.63
7.3.70.0000.00716.63
7.3.60.0000.00716.74
7.3.50.0030.00316.78
7.3.40.0000.00716.76
7.3.30.0030.00316.60
7.3.20.0040.00416.67
7.3.10.0030.00516.72
7.3.00.0040.00416.69

preferences:
31.93 ms | 403 KiB | 5 Q