3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertToTimestamp($dateStr) { $dateStr = trim($dateStr); if (!function_exists('date_create')) { $ts = strtotime($dateStr); if ($ts === -1) $ts = false; return $ts; } $oDate = date_create($dateStr); if (is_object($oDate)) { return (int)$oDate->format('U'); } return false; } var_dump( convertToTimestamp("2012-01-01") ); // 1325376000 echo "\n"; var_dump( convertToTimestamp("foo") ); // sollte false oder -1

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.60.0140.00716.63
8.3.50.0080.01016.74
8.3.40.0220.00018.67
8.3.30.0040.01118.84
8.3.20.0040.00418.90
8.3.10.0040.00420.65
8.3.00.0080.00019.50
8.2.180.0140.00416.75
8.2.170.0130.00722.96
8.2.160.0100.00321.27
8.2.150.0030.00524.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0050.00320.08
8.2.110.0070.00320.93
8.2.100.0000.01217.97
8.2.90.0080.00019.34
8.2.80.0100.00018.01
8.2.70.0000.00817.88
8.2.60.0000.00818.05
8.2.50.0080.00318.07
8.2.40.0060.00318.34
8.2.30.0040.00418.05
8.2.20.0060.00317.95
8.2.10.0040.00417.91
8.2.00.0060.00317.98
8.1.280.0040.01125.92
8.1.270.0080.00024.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0070.00420.89
8.1.230.0040.00720.83
8.1.220.0000.00817.74
8.1.210.0110.00018.84
8.1.200.0030.00617.47
8.1.190.0050.00317.66
8.1.180.0060.00318.10
8.1.170.0040.00418.90
8.1.160.0000.00819.05
8.1.150.0070.00018.84
8.1.140.0000.00917.69
8.1.130.0000.00817.90
8.1.120.0070.00017.61
8.1.110.0040.00417.67
8.1.100.0050.00317.66
8.1.90.0040.00417.70
8.1.80.0070.00017.62
8.1.70.0040.00417.63
8.1.60.0000.00817.75
8.1.50.0070.00017.56
8.1.40.0000.00917.73
8.1.30.0020.00517.67
8.1.20.0110.00017.68
8.1.10.0040.00417.67
8.1.00.0000.00817.70
8.0.300.0000.00720.01
8.0.290.0000.00816.88
8.0.280.0040.00418.57
8.0.270.0030.00317.38
8.0.260.0000.00717.07
8.0.250.0050.00317.24
8.0.240.0000.00817.24
8.0.230.0000.00817.21
8.0.220.0000.00717.11
8.0.210.0070.00017.14
8.0.200.0030.00317.21
8.0.190.0000.00717.22
8.0.180.0000.00817.19
8.0.170.0000.00817.06
8.0.160.0000.00717.25
8.0.150.0000.00816.97
8.0.140.0050.00317.09
8.0.130.0000.00513.50
8.0.120.0000.00717.12
8.0.110.0040.00417.11
8.0.100.0040.00417.23
8.0.90.0000.00717.11
8.0.80.0030.01717.12
8.0.70.0040.00417.03
8.0.60.0050.00317.13
8.0.50.0040.00417.12
8.0.30.0120.00517.30
8.0.20.0070.01517.48
8.0.10.0040.00417.21
8.0.00.0110.00817.04
7.4.330.0050.00013.18
7.4.320.0060.00016.82
7.4.300.0030.00316.69
7.4.290.0070.00016.78
7.4.280.0050.00216.70
7.4.270.0030.00316.66
7.4.260.0000.00613.31
7.4.250.0060.00316.69
7.4.240.0040.00416.68
7.4.230.0030.00316.78
7.4.220.0100.01016.79
7.4.210.0050.00916.72
7.4.200.0030.00516.72
7.4.190.0040.00416.66
7.4.160.0120.00816.59
7.4.150.0040.01516.77
7.4.140.0120.00516.57
7.4.130.0110.00616.65
7.4.120.0140.00316.59
7.4.110.0080.00816.66
7.4.100.0110.00616.96
7.4.90.0000.01716.72
7.4.80.0070.01316.83
7.4.70.0030.01516.55
7.4.60.0110.01116.71
7.4.50.0030.00616.56
7.4.40.0130.00316.88
7.4.30.0080.00816.86
7.4.00.0070.01015.35
7.3.330.0000.00613.34
7.3.320.0060.00013.20
7.3.310.0070.00016.44
7.3.300.0070.00016.43
7.3.290.0120.00316.43
7.3.280.0060.01116.45
7.3.270.0070.01016.70
7.3.260.0130.00816.66
7.3.250.0120.01016.68
7.3.240.0060.00916.56
7.3.230.0140.00316.64
7.3.210.0060.01216.54
7.3.200.0090.00819.39
7.3.190.0060.01116.69
7.3.180.0100.00616.83
7.3.170.0040.01616.59
7.3.160.0090.00616.61
7.3.120.0000.01215.36
7.2.330.0100.00716.88
7.2.320.0100.01416.83
7.2.310.0110.00816.86
7.2.300.0150.00316.80
7.2.290.0130.00316.83
7.1.70.0120.00017.44
7.1.60.0070.01719.40
7.1.50.0040.01417.04
7.1.00.0100.06022.30
7.0.200.0060.00615.22
7.0.140.0070.07022.15
7.0.120.0070.05022.09
7.0.60.0000.06319.97
7.0.50.0070.04017.82
7.0.40.0030.09720.11
7.0.30.0300.05020.26
7.0.20.0200.07320.17
7.0.10.0130.05720.10
7.0.00.0130.08020.33
5.6.280.0100.06720.99
5.6.210.0070.08720.47
5.6.200.0030.04318.16
5.6.190.0070.04320.42
5.6.180.0270.05020.52
5.6.170.0370.06320.55
5.6.160.0100.04320.50
5.6.150.0100.07018.29
5.6.140.0070.07718.23
5.6.130.0130.06018.15
5.6.120.0030.07021.01
5.6.110.0200.06320.99
5.6.100.0100.08021.01
5.6.90.0030.04020.98
5.6.80.0030.04020.41
5.6.70.0370.07320.41
5.5.350.0200.08320.52
5.5.340.0030.08317.98
5.5.330.0030.05020.27
5.5.320.0130.04320.34
5.5.310.0070.05320.14
5.5.300.0100.07317.99
5.5.290.0070.05317.94
5.5.280.0030.04720.87
5.5.270.0200.06320.76
5.5.260.0000.04320.73
5.5.250.0030.07720.69
5.5.240.0130.07720.21
5.4.450.0700.03319.46
5.4.440.0600.03319.37
5.4.430.0500.04019.56
5.4.420.0630.03019.34
5.4.410.0730.03019.42
5.4.400.0570.03019.13
5.4.390.0400.04319.14
5.4.380.0400.05019.16
5.4.370.0370.05319.20
5.4.360.0470.04019.04
5.4.350.0230.04719.23
5.4.340.0730.03318.83
5.4.320.0800.03019.00
5.4.310.0630.02719.16
5.4.300.0470.04719.13
5.4.290.0630.03319.21
5.4.280.0400.03719.06
5.4.270.0830.03319.05
5.4.260.0170.04319.22
5.4.250.0430.04319.13
5.4.240.0330.04019.05
5.4.230.0800.03319.13
5.4.220.0300.03718.98
5.4.210.0100.04719.30
5.4.200.0300.04718.84
5.4.190.0300.03719.21
5.4.180.0570.03718.91
5.4.170.0430.03718.94
5.4.160.0400.04319.02
5.4.150.1030.03019.21
5.4.140.0270.03716.45
5.4.130.0270.03716.41
5.4.120.0430.02716.37
5.4.110.0730.03316.29
5.4.100.0900.02716.56
5.4.90.0730.02316.49
5.4.80.0370.04016.46
5.4.70.0470.04016.59
5.4.60.0930.03316.52
5.4.50.0400.03716.54
5.4.40.0830.02716.43
5.4.30.0270.03316.48
5.4.20.0370.03716.42
5.4.10.0430.05016.52
5.4.00.0530.03315.94
5.3.290.0530.03715.07
5.3.280.0400.03315.10
5.3.270.0630.04315.09
5.3.260.0730.03715.09
5.3.250.0630.03715.09
5.3.240.0500.04015.08
5.3.230.0030.03015.08
5.3.220.0530.03715.08
5.3.210.0830.04015.08
5.3.200.0630.03315.08
5.3.190.0530.03715.08
5.3.180.0530.03715.08
5.3.170.0700.04015.08
5.3.160.0470.04315.08
5.3.150.0200.04015.08
5.3.140.0530.03715.08
5.3.130.0370.05315.08
5.3.120.0570.03715.08
5.3.110.0130.04715.08
5.3.100.0530.04015.08
5.3.90.0500.04015.08
5.3.80.0700.05315.08
5.3.70.0530.04015.08
5.3.60.0470.04315.08
5.3.50.0800.03315.08
5.3.40.0530.03715.08
5.3.30.0630.03315.08
5.3.20.0730.03015.08
5.3.10.0530.05015.08
5.3.00.0500.04315.08
5.2.170.0570.03015.08
5.2.160.0400.03315.08
5.2.150.0570.03715.08
5.2.140.0670.02315.08
5.2.130.0370.03315.08
5.2.120.0400.03715.08
5.2.110.0930.02715.08
5.2.100.0030.02315.08
5.2.90.0230.02315.08
5.2.80.0400.02015.08
5.2.70.0570.03715.08
5.2.60.0530.02715.08
5.2.50.0130.04715.08
5.2.40.0370.03015.08
5.2.30.0430.03015.08
5.2.20.0370.03015.08
5.2.10.0330.02715.07
5.2.00.0270.03015.07
5.1.60.0600.02315.07
5.1.50.0570.02315.07
5.1.40.0400.02715.07
5.1.30.0370.03015.07
5.1.20.0730.02015.07
5.1.10.0230.02315.07
5.1.00.0370.03315.07
5.0.50.0230.02015.07
5.0.40.0230.02015.07
5.0.30.0070.03715.07
5.0.20.0230.01715.07
5.0.10.0070.02315.07
5.0.00.0300.02715.07
4.4.90.0130.01715.08
4.4.80.0200.01715.08
4.4.70.0200.02315.08
4.4.60.0070.01315.08
4.4.50.0300.01315.07
4.4.40.0170.01315.07
4.4.30.0230.01715.07
4.4.20.0400.01315.07
4.4.10.0070.02015.07
4.4.00.0300.02015.07
4.3.110.0070.02015.07
4.3.100.0170.01715.07
4.3.90.0070.01315.07
4.3.80.0200.02015.07
4.3.70.0430.00715.05
4.3.60.0370.01015.05
4.3.50.0070.01715.05
4.3.40.0230.02315.05
4.3.30.0030.02015.05
4.3.20.0070.02015.05
4.3.10.0100.02015.05
4.3.00.0030.01715.05

preferences:
70.3 ms | 401 KiB | 5 Q