3v4l.org

run code in 300+ PHP versions simultaneously
<?php $currentDate = date("Y-m-d"); $currentTime = date("H:i:s"); $currentDateHour = date("H", strtotime($currentDate . " " . $currentTime)); // 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.60.0060.00918.52
8.3.50.0120.00321.21
8.3.40.0070.00719.08
8.3.30.0070.01020.35
8.3.20.0060.00318.99
8.3.10.0040.00421.07
8.3.00.0080.00022.39
8.2.180.0110.00417.00
8.2.170.0100.00722.96
8.2.160.0070.01020.39
8.2.150.0080.00024.18
8.2.140.0070.00324.66
8.2.130.0070.00026.16
8.2.120.0050.00221.18
8.2.110.0070.00320.90
8.2.100.0040.00817.91
8.2.90.0000.00819.35
8.2.80.0000.00818.16
8.2.70.0060.00317.88
8.2.60.0040.00418.18
8.2.50.0000.00818.07
8.2.40.0030.00518.28
8.2.30.0000.01019.46
8.2.20.0000.00718.04
8.2.10.0060.00318.02
8.2.00.0000.00718.02
8.1.280.0120.00325.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.88
8.1.230.0080.00417.91
8.1.220.0050.00318.77
8.1.210.0040.00419.11
8.1.200.0070.00317.47
8.1.190.0030.00517.63
8.1.180.0000.00818.10
8.1.170.0000.00918.71
8.1.160.0070.00018.92
8.1.150.0080.00318.91
8.1.140.0060.00317.57
8.1.130.0020.00517.66
8.1.120.0020.00517.58
8.1.110.0020.00517.68
8.1.100.0000.00817.58
8.1.90.0000.00717.59
8.1.80.0000.00717.72
8.1.70.0040.00417.66
8.1.60.0000.00817.63
8.1.50.0000.00917.65
8.1.40.0000.00717.68
8.1.30.0000.00817.73
8.1.20.0040.00417.76
8.1.10.0000.00717.61
8.1.00.0000.00717.76
8.0.300.0050.00219.88
8.0.290.0060.00317.18
8.0.280.0000.00818.48
8.0.270.0030.00317.43
8.0.260.0000.00817.14
8.0.250.0000.00717.15
8.0.240.0030.00617.28
8.0.230.0030.00317.26
8.0.220.0040.00417.07
8.0.210.0070.00017.16
8.0.200.0070.00017.17
8.0.190.0030.00517.14
8.0.180.0000.00717.20
8.0.170.0080.00017.09
8.0.160.0070.00017.23
8.0.150.0040.00417.15
8.0.140.0040.00417.07
8.0.130.0030.00313.49
8.0.120.0000.00817.10
8.0.110.0000.00717.24
8.0.100.0000.00817.07
8.0.90.0030.00517.13
8.0.80.0060.00917.13
8.0.70.0060.00317.20
8.0.60.0040.00417.05
8.0.50.0000.00817.05
8.0.30.0090.00917.41
8.0.20.0110.00717.40
8.0.10.0000.00717.18
8.0.00.0090.00916.97
7.4.330.0000.00516.78
7.4.320.0030.00316.66
7.4.300.0030.00316.75
7.4.290.0000.00716.75
7.4.280.0030.00316.67
7.4.270.0050.00316.74
7.4.260.0040.00416.69
7.4.250.0080.00016.58
7.4.240.0070.00016.67
7.4.230.0000.00716.44
7.4.220.0070.01116.58
7.4.210.0080.00716.66
7.4.200.0030.00316.59
7.4.190.0000.00716.79
7.4.160.0060.00916.75
7.4.150.0090.00917.40
7.4.140.0110.00617.86
7.4.130.0080.00916.74
7.4.120.0130.00416.79
7.4.110.0100.01016.50
7.4.100.0130.00416.57
7.4.90.0150.00616.82
7.4.80.0060.01319.39
7.4.70.0090.00816.60
7.4.60.0090.00816.47
7.4.50.0040.00416.69
7.4.40.0100.00522.77
7.4.30.0030.01316.82
7.4.00.0090.01115.38
7.3.330.0020.00213.34
7.3.320.0020.00213.18
7.3.310.0070.00016.41
7.3.300.0060.00016.50
7.3.290.0130.00716.44
7.3.280.0100.00616.54
7.3.270.0070.01017.40
7.3.260.0140.00618.24
7.3.250.0060.01316.54
7.3.240.0070.01116.55
7.3.230.0070.01116.57
7.3.210.0180.00016.82
7.3.200.0020.01119.39
7.3.190.0080.01016.75
7.3.180.0060.00916.59
7.3.170.0060.00916.61
7.3.160.0040.01416.68
7.3.120.0100.00714.91
7.3.110.0120.00315.00
7.3.100.0070.01115.15
7.3.90.0070.00715.05
7.3.80.0040.01114.77
7.3.70.0000.01315.12
7.3.60.0030.00714.94
7.3.50.0090.00615.00
7.3.40.0070.00415.15
7.3.30.0070.00714.72
7.3.20.0080.00017.02
7.3.10.0130.00016.90
7.3.00.0040.00716.53
7.2.330.0090.00916.90
7.2.320.0100.00716.71
7.2.310.0030.01616.85
7.2.300.0080.01216.70
7.2.290.0130.00316.80
7.2.250.0160.00315.24
7.2.240.0060.01215.34
7.2.230.0080.00815.11
7.2.220.0030.01415.45
7.2.210.0070.00715.40
7.2.200.0040.00715.23
7.2.190.0120.00315.22
7.2.180.0000.01415.07
7.2.170.0000.01215.20
7.2.60.0040.00817.26
7.2.00.0030.01019.32
7.1.330.0070.01015.61
7.1.320.0030.00615.72
7.1.310.0070.00715.83
7.1.300.0060.00615.70
7.1.290.0030.01016.08
7.1.280.0060.00715.95
7.1.270.0040.01116.05
7.1.260.0060.00315.80
7.1.200.0090.00616.11
7.1.100.0100.00018.51
7.1.70.0000.00917.41
7.1.60.0060.01919.17
7.1.50.0060.01617.06
7.1.00.0000.07722.48
7.0.200.0000.01016.95
7.0.140.0000.07722.08
7.0.90.0070.04319.99
7.0.80.0000.05019.90
7.0.70.0170.06719.93
7.0.60.0170.04019.87
7.0.50.0070.05022.11
7.0.40.0030.04320.09
7.0.30.0100.04320.07
7.0.20.0070.04020.09
7.0.10.0070.07720.12
7.0.00.0070.08320.02
5.6.280.0070.07020.92
5.6.240.0000.04320.57
5.6.230.0000.04320.59
5.6.220.0100.03320.67
5.6.210.0030.04720.64
5.6.200.0030.04021.11
5.6.190.0000.04721.08
5.6.180.0030.05021.16
5.6.170.0100.06321.13
5.6.160.0130.03320.95
5.6.150.0070.03721.13
5.6.140.0030.04321.16
5.6.130.0000.04321.00
5.6.120.0130.03720.93
5.6.110.0030.04320.95
5.6.100.0000.04321.00
5.6.90.0030.04020.91
5.6.80.0000.04020.32
5.6.70.0070.06320.45
5.6.60.0100.07720.40
5.6.50.0070.08320.52
5.6.40.0030.06320.43
5.6.30.0170.04020.43
5.6.20.0030.08320.38
5.6.10.0100.07720.36
5.6.00.0070.07720.29
5.5.380.0030.04020.44
5.5.370.0030.04020.42
5.5.360.0070.07020.36
5.5.350.0070.03720.43
5.5.340.0030.04720.76
5.5.330.0070.04320.87
5.5.320.0030.04720.76
5.5.310.0100.03320.82
5.5.300.0070.05020.91
5.5.290.0070.04020.82
5.5.280.0000.04320.87
5.5.270.0000.04020.71
5.5.260.0030.04020.78
5.5.250.0130.02720.58
5.5.240.0100.06020.21
5.5.230.0000.07720.26
5.5.220.0070.09020.29
5.5.210.0000.08320.28
5.5.200.0100.04720.13
5.5.190.0170.05020.14
5.5.180.0030.07720.24
5.5.160.0100.05020.23
5.5.150.0130.04720.14
5.5.140.0070.07720.22
5.5.130.0100.07020.13
5.5.120.0100.07320.17
5.5.110.0130.06720.22
5.5.100.0100.07720.09
5.5.90.0070.08320.09
5.5.80.0070.07320.04
5.5.70.0070.07720.05
5.5.60.0100.07720.14
5.5.50.0130.07019.93
5.5.40.0100.04020.10
5.5.30.0070.06720.05
5.5.20.0000.08720.07
5.5.10.0100.07320.13
5.5.00.0070.08019.96
5.4.450.0030.04319.31
5.4.440.0100.07019.13
5.4.430.0030.04019.44
5.4.420.0070.03719.13
5.4.410.0000.03719.43
5.4.400.0000.03719.12
5.4.390.0000.07718.91
5.4.380.0000.04319.07
5.4.370.0000.06018.81
5.4.360.0100.07319.06
5.4.350.0030.04719.13
5.4.340.0070.06019.02
5.4.320.0070.07719.04
5.4.310.0000.08018.79
5.4.300.0070.07019.07
5.4.290.0100.07318.96
5.4.280.0030.08019.05
5.4.270.0070.07318.81
5.4.260.0070.08019.12
5.4.250.0030.08718.94
5.4.240.0200.06018.94
5.4.230.0030.03719.22
5.4.220.0070.08019.11
5.4.210.0000.07018.91
5.4.200.0100.04718.84
5.4.190.0070.05718.77
5.4.180.0070.04318.80
5.4.170.0000.06318.93
5.4.160.0030.06019.12
5.4.150.0070.07018.94
5.4.140.0030.09016.33
5.4.130.0030.07016.11
5.4.120.0030.07016.11
5.4.110.0100.03016.49
5.4.100.0000.04316.26
5.4.90.0030.07316.36
5.4.80.0030.09016.36
5.4.70.0070.07316.30
5.4.60.0070.06716.32
5.4.50.0070.06716.30
5.4.40.0000.06716.33
5.4.30.0070.07316.28
5.4.20.0000.08016.35
5.4.10.0070.05716.27
5.4.00.0030.08315.81
5.3.290.0130.06014.64
5.3.280.0030.07714.43
5.3.270.0030.08014.59
5.3.260.0100.06314.59
5.3.250.0000.07714.60
5.3.240.0070.07714.57
5.3.230.0000.09314.42
5.3.220.0070.05314.53
5.3.210.0000.05014.57
5.3.200.0030.03714.58
5.3.190.0070.07714.52
5.3.180.0070.07314.52
5.3.170.0070.07714.52
5.3.160.0000.08014.56
5.3.150.0170.07014.40
5.3.140.0030.07714.51
5.3.130.0030.08714.50
5.3.120.0030.07714.54
5.3.110.0100.08014.48
5.3.100.0100.06713.94
5.3.90.0070.05713.95
5.3.80.0000.07713.79
5.3.70.0070.05013.87
5.3.60.0100.06713.86
5.3.50.0030.04713.80
5.3.40.0070.05313.71
5.3.30.0070.07013.88
5.3.20.0000.07713.55
5.3.10.0030.04313.56
5.3.00.0100.05713.60
5.2.170.0070.05711.16
5.2.160.0030.06311.16
5.2.150.0000.04311.16
5.2.140.0030.04311.16
5.2.130.0000.06011.16
5.2.120.0100.03711.16
5.2.110.0000.05011.16
5.2.100.0030.04011.16
5.2.90.0030.06011.16
5.2.80.0000.06711.16
5.2.70.0030.06311.16
5.2.60.0070.06311.16
5.2.50.0000.07711.16
5.2.40.0000.06311.16
5.2.30.0030.06311.16
5.2.20.0030.06011.16
5.2.10.0030.06011.16
5.2.00.0000.03011.16
5.1.60.0000.02711.16
5.1.50.0070.05011.16
5.1.40.0030.05311.16
5.1.30.0000.05311.16
5.1.20.0030.03011.16
5.1.10.0000.05711.16
5.1.00.0030.05011.16
5.0.50.0030.03311.16
5.0.40.0070.04011.16
5.0.30.0100.05711.16
5.0.20.0030.04711.16
5.0.10.0030.04711.16
5.0.00.0030.05011.16
4.4.90.0000.03711.16
4.4.80.0000.03311.16
4.4.70.0030.03011.16
4.4.60.0030.03311.16
4.4.50.0000.04011.16
4.4.40.0000.04011.16
4.4.30.0000.03311.16
4.4.20.0000.04311.16
4.4.10.0000.03711.16
4.4.00.0030.05311.16
4.3.110.0000.03011.16
4.3.100.0000.02311.16
4.3.90.0000.02711.16
4.3.80.0000.05311.16
4.3.70.0030.03311.16
4.3.60.0000.03311.16
4.3.50.0000.03311.16
4.3.40.0030.05011.16
4.3.30.0000.04011.16
4.3.20.0030.02311.16
4.3.10.0030.03011.16
4.3.00.0030.03311.16

preferences:
33.22 ms | 401 KiB | 5 Q