3v4l.org

run code in 300+ PHP versions simultaneously
<?php $currentDate = date("Y-m-d"); $currentTime = date("H:i:s"); $row2['post_date'] = "2013-12-02 10:00:00"; $currentDateHour = date("H"); echo $currentDateHour; die(); // This is the date I'm pulling from the database, it only displays // when in strtotime for some reason. It displays accurately to what is in the mySQL DB $upDate = date("Y-m-d H", strtotime($row2['post_date'])); // Some variables to make life easier for later if statements if I ever get that far. Displays accurately. $upDatehour = date("H", strtotime($row2['post_date'])); // trying simple subtraction $hour = $currentDateHour - $upDatehour; // this is where the result is incorrect, what is wrong here? Any method I've tried gives me the same result, with or without strotime.. it's gotta be something simple, always is! print $hour;

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.70.0120.00616.58
8.3.60.0170.00318.68
8.3.50.0110.00421.14
8.3.40.0090.00618.88
8.3.30.0100.00320.16
8.3.20.0030.00518.85
8.3.10.0000.00821.27
8.3.00.0040.00422.37
8.2.180.0140.00418.48
8.2.170.0090.00922.96
8.2.160.0070.00720.52
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0040.00421.12
8.2.110.0030.00622.30
8.2.100.0080.00418.03
8.2.90.0040.00419.20
8.2.80.0030.00517.97
8.2.70.0050.00317.88
8.2.60.0000.00918.02
8.2.50.0050.00518.07
8.2.40.0030.00618.47
8.2.30.0040.00419.32
8.2.20.0040.00417.86
8.2.10.0050.00317.80
8.2.00.0080.00017.88
8.1.280.0150.00625.92
8.1.270.0030.00623.99
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0000.00822.20
8.1.230.0080.00417.64
8.1.220.0050.00317.78
8.1.210.0040.00418.77
8.1.200.0060.00317.48
8.1.190.0060.00317.43
8.1.180.0090.00318.10
8.1.170.0040.00418.47
8.1.160.0000.00718.83
8.1.150.0030.00618.63
8.1.140.0050.00217.53
8.1.130.0000.00717.89
8.1.120.0040.00417.51
8.1.110.0040.00417.48
8.1.100.0040.00417.42
8.1.90.0040.00417.48
8.1.80.0020.00517.53
8.1.70.0030.00317.51
8.1.60.0080.00017.62
8.1.50.0040.00417.46
8.1.40.0040.00417.58
8.1.30.0040.00417.71
8.1.20.0080.00017.65
8.1.10.0030.00617.53
8.1.00.0000.00917.57
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0040.00418.57
8.0.270.0040.00417.33
8.0.260.0000.00717.07
8.0.250.0000.00717.07
8.0.240.0030.00717.07
8.0.230.0030.00317.00
8.0.220.0040.00417.09
8.0.210.0000.00717.08
8.0.200.0040.00417.04
8.0.190.0030.00317.04
8.0.180.0000.00717.04
8.0.170.0080.00016.96
8.0.160.0040.00416.90
8.0.150.0030.00516.94
8.0.140.0040.00416.93
8.0.130.0030.00313.26
8.0.120.0000.00816.93
8.0.110.0040.00417.00
8.0.100.0030.00616.91
8.0.90.0050.00317.00
8.0.80.0100.00516.97
8.0.70.0040.00416.99
8.0.60.0000.00716.95
8.0.50.0000.00716.86
8.0.30.0100.01317.12
8.0.20.0050.01317.41
8.0.10.0000.00717.17
8.0.00.0060.01616.81
7.4.330.0000.00516.79
7.4.320.0000.00616.63
7.4.300.0030.00316.42
7.4.290.0000.00716.47
7.4.280.0000.00716.60
7.4.270.0000.00716.42
7.4.260.0050.00013.17
7.4.250.0040.00416.55
7.4.240.0030.00316.51
7.4.230.0030.00316.59
7.4.220.0140.00416.60
7.4.210.0090.00616.55
7.4.200.0030.00316.59
7.4.190.0070.00016.77
7.4.160.0040.01116.64
7.4.150.0090.00917.40
7.4.140.0100.00717.86
7.4.130.0110.00616.59
7.4.120.0070.01016.55
7.4.110.0140.00716.65
7.4.100.0100.00716.62
7.4.90.0070.01016.42
7.4.80.0080.01219.39
7.4.70.0090.01316.61
7.4.60.0090.00916.73
7.4.50.0000.00716.30
7.4.40.0120.00322.77
7.4.30.0140.00816.30
7.4.00.0130.00015.05
7.3.330.0030.00313.13
7.3.320.0030.00313.29
7.3.310.0000.00816.23
7.3.300.0030.00316.41
7.3.290.0000.01516.34
7.3.280.0100.00716.39
7.3.270.0100.00617.40
7.3.260.0100.01218.24
7.3.250.0090.00816.40
7.3.240.0110.00616.53
7.3.230.0100.00716.48
7.3.210.0070.01016.80
7.3.200.0020.00319.39
7.3.190.0160.00716.35
7.3.180.0150.00016.50
7.3.170.0060.00916.36
7.3.160.0060.01016.58
7.3.120.0030.01215.00
7.2.330.0040.01516.45
7.2.320.0040.01316.56
7.2.310.0070.01416.57
7.2.300.0090.01216.74
7.2.290.0070.01016.91
7.2.00.0030.01019.62
7.1.100.0080.00318.31
7.1.70.0040.00817.32
7.1.60.0150.01119.17
7.1.50.0090.01516.70
7.1.00.0030.03322.37
7.0.200.0040.00416.97
7.0.140.0070.06722.06
7.0.100.0070.08721.69
7.0.90.0000.05321.67
7.0.80.0000.06021.78
7.0.70.0070.05021.76
7.0.60.0070.06021.69
7.0.50.0100.04722.09
7.0.40.0100.08020.11
7.0.30.0070.08320.04
7.0.20.0170.07720.12
7.0.10.0130.07320.09
7.0.00.0070.08020.18
5.6.280.0030.07020.98
5.6.250.0100.05020.59
5.6.240.0030.08320.54
5.6.230.0070.08020.71
5.6.220.0070.04720.49
5.6.210.0070.06720.74
5.6.200.0030.05721.11
5.6.190.0070.08021.13
5.6.180.0030.06021.05
5.6.170.0200.07021.08
5.6.160.0100.08021.03
5.6.150.0130.06321.10
5.6.140.0130.07321.16
5.6.130.0070.08721.10
5.6.120.0200.07021.00
5.6.110.0100.03721.07
5.6.100.0100.07020.93
5.6.90.0030.04320.93
5.6.80.0000.04720.32
5.6.70.0000.04720.38
5.6.60.0070.03720.41
5.6.50.0030.04320.55
5.6.40.0030.04020.29
5.6.30.0070.03720.43
5.6.20.0100.03020.35
5.6.10.0070.07020.45
5.6.00.0030.04020.45
5.5.380.0070.08720.51
5.5.370.0070.08020.34
5.5.360.0070.07320.41
5.5.350.0000.04320.47
5.5.340.0100.08020.77
5.5.330.0030.05320.73
5.5.320.0070.08320.75
5.5.310.0000.08720.82
5.5.300.0070.06320.75
5.5.290.0000.07720.64
5.5.280.0070.08720.88
5.5.270.0070.08720.89
5.5.260.0000.08720.91
5.5.250.0100.04320.64
5.5.240.0030.04320.27
5.5.230.0030.04320.29
5.5.220.0000.04720.19
5.5.210.0070.03720.23
5.5.200.0070.03720.14
5.5.190.0000.04320.21
5.5.180.0000.06320.07
5.5.160.0030.04020.14
5.5.150.0000.04320.22
5.5.140.0070.03319.98
5.5.130.0000.04020.07
5.5.120.0070.03020.23
5.5.110.0070.03320.11
5.5.100.0030.04020.07
5.5.90.0030.03720.10
5.5.80.0030.03720.16
5.5.70.0100.03020.05
5.5.60.0000.04020.05
5.5.50.0070.04020.13
5.5.40.0030.03320.09
5.5.30.0030.03720.05
5.5.20.0070.03320.14
5.5.10.0000.04019.96
5.5.00.0030.03719.95
5.4.450.0000.08319.37
5.4.440.0130.05019.35
5.4.430.0070.07319.38
5.4.420.0170.07319.13
5.4.410.0000.04319.25
5.4.400.0070.04019.05
5.4.390.0070.04019.03
5.4.380.0030.03719.14
5.4.370.0030.04319.06
5.4.360.0000.04319.16
5.4.350.0030.03319.09
5.4.340.0070.03318.96
5.4.320.0000.04018.90
5.4.310.0070.03719.12
5.4.300.0070.03318.90
5.4.290.0030.04318.94
5.4.280.0070.03319.05
5.4.270.0100.03019.14
5.4.260.0030.03319.11
5.4.250.0000.04018.84
5.4.240.0030.03718.97
5.4.230.0030.05319.05
5.4.220.0030.03718.89
5.4.210.0000.04019.06
5.4.200.0030.03719.04
5.4.190.0030.04319.02
5.4.180.0030.03719.09
5.4.170.0000.04719.10
5.4.160.0030.03718.79
5.4.150.0000.06019.21
5.4.140.0000.03716.39
5.4.130.0030.03316.30
5.4.120.0030.03316.42
5.4.110.0100.03716.27
5.4.100.0030.03016.32
5.4.90.0070.03716.36
5.4.80.0030.03316.34
5.4.70.0030.07316.36
5.4.60.0130.04316.29
5.4.50.0000.03716.18
5.4.40.0030.03716.24
5.4.30.0030.03716.34
5.4.20.0100.07016.33
5.4.10.0100.06016.28
5.4.00.0100.07015.71
5.3.290.0000.04014.64
5.3.280.0030.03714.50
5.3.270.0070.03314.56
5.3.260.0000.04014.58
5.3.250.0030.03314.55
5.3.240.0030.03714.44
5.3.230.0000.04014.45
5.3.220.0070.06014.42
5.3.210.0070.03314.52
5.3.200.0100.03314.55
5.3.190.0030.06314.43
5.3.180.0000.07714.42
5.3.170.0070.07714.39
5.3.160.0030.04714.42
5.3.150.0070.04314.38
5.3.140.0070.03314.55
5.3.130.0000.04014.50
5.3.120.0030.04014.45
5.3.110.0100.05314.51
5.3.100.0130.07014.02
5.3.90.0030.07013.87
5.3.80.0030.07014.02
5.3.70.0030.07013.99
5.3.60.0070.03713.86
5.3.50.0030.04013.93
5.3.40.0070.06713.89
5.3.30.0000.07013.84
5.3.20.0030.04013.70
5.3.10.0000.07713.51
5.3.00.0100.06013.64
5.2.170.0030.06011.00
5.2.160.0070.05711.21
5.2.150.0070.05311.13
5.2.140.0070.06011.17
5.2.130.0000.03711.08
5.2.120.0030.03011.09
5.2.110.0070.05310.95
5.2.100.0070.03711.05
5.2.90.0070.05711.13
5.2.80.0070.04711.04
5.2.70.0000.04710.91
5.2.60.0070.06011.10
5.2.50.0070.06010.98
5.2.40.0070.03310.99
5.2.30.0070.05311.01
5.2.20.0170.05010.90
5.2.10.0030.06010.90
5.2.00.0070.06010.61
5.1.60.0000.0579.89
5.1.50.0030.02710.05
5.1.40.0030.03310.02
5.1.30.0000.03710.34
5.1.20.0070.05310.38
5.1.10.0030.05310.10
5.1.00.0030.05310.09
5.0.50.0000.0339.16
5.0.40.0000.0479.16
5.0.30.0030.0639.16
5.0.20.0070.0379.16
5.0.10.0070.0209.16
5.0.00.0030.0739.16
4.4.90.0000.0309.16
4.4.80.0000.0339.16
4.4.70.0000.0379.16
4.4.60.0000.0279.16
4.4.50.0030.0309.16
4.4.40.0000.0579.16
4.4.30.0070.0309.16
4.4.20.0030.0339.16
4.4.10.0000.0239.16
4.4.00.0000.0579.16
4.3.110.0000.0309.16
4.3.100.0000.0339.16
4.3.90.0000.0309.16
4.3.80.0000.0309.16
4.3.70.0000.0279.16
4.3.60.0000.0209.16
4.3.50.0000.0379.16
4.3.40.0000.0539.16
4.3.30.0000.0279.16
4.3.20.0030.0339.16
4.3.10.0030.0339.16
4.3.00.0030.0339.16

preferences:
46.21 ms | 401 KiB | 5 Q