3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/London'); $date3 = DateTime::createFromFormat('Y-m-d H:i:s', '2019-04-01 00:00:00'); // 2019-04-01 00:00:00.0 Europe/London (+01:00) $date4 = clone $date3; $date4->modify('+5 week'); // 2019-05-06 00:00:00.0 Europe/London (+01:00) echo "So the originally modified date with 5 weeks added is:"; print_r($date4); echo "\n\n"; // positive DIFF and addition echo "1. positive DIFF and addition\n"; echo "diff is: "; $positiveDifferenceDateInterval2 = $date3->diff($date4); // interval: + 1m 4d; days 35 print_r($positiveDifferenceDateInterval2->format('%R %mm %dd')); echo "; days: {$positiveDifferenceDateInterval2->days} \n"; $positiveAddedDate = clone $date3; $positiveAddedDate->add($positiveDifferenceDateInterval2); print_r($positiveAddedDate); echo "is it equal to \$date4? "; var_dump($date4->getTimestamp() === $positiveAddedDate->getTimestamp()); echo "\n"; // negative DIFF and addition echo "2. negative DIFF and addition\n"; echo "diff is: "; $negativeDifferenceDateInterval2 = $date4->diff($date3); // interval: - 1m 5d; days 35 print_r($negativeDifferenceDateInterval2->format('%R %mm %dd')); echo "; days {$negativeDifferenceDateInterval2->days}"; $negativeAddedDate = clone $date3; // so in order to make it equal to $date4 I need to subtract a negative interval instead of adding a positive one? how crazy is that?! $negativeAddedDate->sub($negativeDifferenceDateInterval2); print_r($negativeAddedDate); echo "is it equal to \$date4? "; var_dump($date4->getTimestamp() === $negativeAddedDate->getTimestamp()); echo "\n\n"; echo 'So in order to make it equal to $date4 I need to subtract a negative interval instead of adding a positive one? How crazy is that?!';

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.0100.00718.56
8.3.50.0120.00916.66
8.3.40.0070.00718.91
8.3.30.0120.00318.79
8.3.20.0040.00421.91
8.3.10.0090.00018.85
8.3.00.0050.00319.14
8.2.180.0120.00616.74
8.2.170.0000.01519.20
8.2.160.0070.00722.96
8.2.150.0000.00824.18
8.2.140.0040.00824.66
8.2.130.0050.00326.16
8.2.120.0040.00420.95
8.2.110.0100.00021.17
8.2.100.0090.00317.84
8.2.90.0000.00818.34
8.2.80.0090.00017.97
8.2.70.0080.00018.05
8.2.60.0080.00018.22
8.2.50.0000.00918.10
8.2.40.0000.01119.29
8.2.30.0040.00419.42
8.2.20.0040.00418.31
8.2.10.0040.00419.66
8.2.00.0000.00818.30
8.1.280.0100.01025.92
8.1.270.0030.00620.33
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00022.67
8.1.230.0040.00720.97
8.1.220.0060.00317.91
8.1.210.0050.00319.03
8.1.200.0000.00817.35
8.1.190.0040.00417.48
8.1.180.0000.01118.10
8.1.170.0040.00418.71
8.1.160.0000.00718.97
8.1.150.0030.00519.00
8.1.140.0030.00320.39
8.1.130.0040.00420.28
8.1.120.0020.00517.71
8.1.110.0040.00417.70
8.1.100.0000.00717.68
8.1.90.0020.00517.60
8.1.80.0000.00817.68
8.1.70.0030.00317.60
8.1.60.0030.00517.79
8.1.50.0040.00417.76
8.1.40.0000.00817.65
8.1.30.0000.00717.93
8.1.20.0000.00817.87
8.1.10.0090.00017.82
8.1.00.0040.00417.80
8.0.300.0040.00420.15
8.0.290.0040.00417.13
8.0.280.0050.00218.54
8.0.270.0040.00417.46
8.0.260.0000.00618.66
8.0.250.0070.00317.24
8.0.240.0000.00717.24
8.0.230.0000.00717.24
8.0.220.0070.00017.21
8.0.210.0030.00317.18
8.0.200.0030.00717.25
8.0.190.0070.00317.14
8.0.180.0080.00017.15
8.0.170.0000.00817.13
8.0.160.0070.00017.21
8.0.150.0000.00717.20
8.0.140.0000.00717.17
8.0.130.0030.00313.61
8.0.120.0080.00017.17
8.0.110.0040.00417.13
8.0.100.0070.00017.04
8.0.90.0040.00416.98
8.0.80.0110.00617.21
8.0.70.0040.00417.21
8.0.60.0050.00317.26
8.0.50.0050.00217.22
8.0.30.0050.01917.17
8.0.20.0190.00617.29
8.0.10.0240.00817.18
8.0.00.0140.01017.00
7.4.330.0000.00415.55
7.4.320.0000.00716.70
7.4.300.0000.00616.85
7.4.290.0070.00016.83
7.4.280.0040.00416.77
7.4.270.0000.01116.63
7.4.260.0060.00316.73
7.4.250.0040.00416.66
7.4.240.0000.00716.82
7.4.230.0050.00316.93
7.4.220.0040.00416.91
7.4.210.0100.00616.81
7.4.200.0000.00716.63
7.4.160.0110.00816.79
7.4.150.0190.01316.76
7.4.140.0070.01617.48
7.4.130.0120.01516.80
7.4.120.0180.00516.75
7.4.110.0140.01016.76
7.4.100.0170.00716.75
7.4.90.0150.01316.75
7.4.80.0190.00417.98
7.4.70.0140.01316.76
7.4.60.0140.00716.62
7.4.50.0090.01316.75
7.4.40.0120.01016.71
7.4.30.0170.01216.77
7.4.20.0140.01116.73
7.4.10.0070.01415.54
7.4.00.0110.00515.54
7.3.330.0000.00513.33
7.3.320.0060.00013.36
7.3.310.0030.00316.61
7.3.300.0000.00716.50
7.3.290.0030.00316.38
7.3.280.0110.00716.49
7.3.270.0270.00416.42
7.3.260.0130.00916.58
7.3.250.0110.01516.59
7.3.240.0150.00716.58
7.3.230.0180.00616.51
7.3.220.0250.00416.53
7.3.210.0150.01016.61
7.3.200.0160.01116.47
7.3.190.0180.00816.54
7.3.180.0150.00716.54
7.3.170.0230.00316.54
7.3.160.0130.01116.54
7.3.150.0230.00816.43
7.3.140.0200.00816.43
7.3.130.0090.01015.50
7.3.120.0090.01215.54
7.3.110.0110.01115.57
7.3.100.0080.00915.45
7.3.90.0140.00415.47
7.3.80.0080.01115.48
7.3.70.0090.00915.45
7.3.60.0150.00415.41
7.3.50.0130.00415.48
7.3.40.0140.00715.48
7.3.30.0090.01015.42
7.3.20.0330.00816.69
7.3.10.0070.01016.68
7.3.00.0100.00716.70
7.2.340.0380.00916.77
7.2.330.0120.01216.85
7.2.320.0130.01216.63
7.2.310.0190.00716.70
7.2.300.0160.00916.66
7.2.290.0150.01016.87
7.2.280.0170.00716.63
7.2.270.0270.00716.62
7.2.260.0110.00915.88
7.2.250.0100.01215.78
7.2.240.0100.01015.71
7.2.230.0110.00815.62
7.2.220.0110.00815.81
7.2.210.0110.00715.78
7.2.200.0120.00815.81
7.2.190.0140.00815.71
7.2.180.0160.01115.67
7.2.170.0140.00815.79
7.2.160.0080.01115.54
7.2.150.0100.01016.99
7.2.140.0120.00617.03
7.2.130.0090.01017.06
7.2.120.0100.00917.10
7.2.110.0070.01017.02
7.2.100.0090.01117.08
7.2.90.0120.00717.09
7.2.80.0070.01316.92
7.2.70.0170.00817.13
7.2.60.0100.01216.96
7.2.50.0090.00917.02
7.2.40.0130.00717.08
7.2.30.0100.00617.12
7.2.20.0040.01417.11
7.2.10.0070.01017.01
7.2.00.0100.00817.01
7.1.330.0050.01416.02
7.1.320.0120.00715.82
7.1.310.0080.00815.89
7.1.300.0130.00915.87
7.1.290.0080.01016.00
7.1.280.0060.01216.00
7.1.270.0120.00716.01
7.1.260.0100.00815.96
7.1.250.0100.00515.92
7.1.240.0120.00615.92
7.1.230.0110.00915.90
7.1.220.0080.00915.86
7.1.210.0150.00815.88
7.1.200.0140.00516.05
7.1.190.0120.00715.94
7.1.180.0070.01116.04
7.1.170.0070.00715.92
7.1.160.0110.00516.03
7.1.150.0100.00715.96
7.1.140.0130.00415.91
7.1.130.0070.01215.97
7.1.120.0100.01015.84
7.1.110.0100.00715.97
7.1.100.0130.00315.87
7.1.90.0110.00415.95
7.1.80.0050.01316.01
7.1.70.0170.00715.83
7.1.60.0080.00815.92
7.1.50.0090.00916.04
7.1.40.0110.00715.84
7.1.30.0120.00915.87
7.1.20.0070.01015.91
7.1.10.0100.00815.79
7.1.00.0060.00915.88
7.0.330.0200.00815.36
7.0.320.0130.01615.41
7.0.310.0160.01015.36
7.0.300.0150.00915.45
7.0.290.0090.01515.50
7.0.280.0170.01715.41
7.0.270.0170.00715.39
7.0.260.0610.01315.36
7.0.250.0150.01215.70
7.0.240.0210.01115.62
7.0.230.0200.00315.56
7.0.220.0150.01015.55
7.0.210.0160.00815.54
7.0.200.0170.01315.52
7.0.190.0150.00715.55
7.0.180.0180.00415.55
7.0.170.0140.01015.61
7.0.160.0640.00715.49
7.0.150.0160.00815.47
7.0.140.0160.00815.50
7.0.130.0200.00515.58
7.0.120.0210.00415.58
7.0.110.0310.00015.41
7.0.100.0180.01315.55
7.0.90.0230.00615.50
7.0.80.0350.00415.45
7.0.70.0120.01215.28
7.0.60.0170.01015.48
7.0.50.0180.00915.38
7.0.40.0170.00915.47
7.0.30.0180.00915.46
7.0.20.0180.00515.48
7.0.10.0230.00415.49
7.0.00.0220.00415.43
5.6.400.0190.01315.98
5.6.390.0140.01116.02
5.6.380.0120.01516.00
5.6.370.0170.01016.03
5.6.360.0160.00916.09
5.6.350.0230.00515.98
5.6.340.0210.01015.96
5.6.330.0160.01216.03
5.6.320.0170.01516.12
5.6.310.0210.01516.11
5.6.300.0150.01115.96
5.6.290.0170.01016.02
5.6.280.0240.00416.08
5.6.270.0230.01316.08
5.6.260.0240.00316.02
5.6.250.0110.01515.89
5.6.240.0200.00616.00
5.6.230.0220.00416.16
5.6.220.0160.01016.15
5.6.210.0170.00816.21
5.6.200.0290.00616.24
5.6.190.0130.01316.08
5.6.180.0180.00916.16
5.6.170.0130.01616.29
5.6.160.0150.00916.27
5.6.150.0170.00716.27
5.6.140.0150.01016.13
5.6.130.0190.00616.19
5.6.120.0180.00516.21
5.6.110.0140.01016.02
5.6.100.0190.00816.14
5.6.90.0160.01215.93
5.6.80.0170.00715.98
5.6.70.0070.01716.15
5.6.60.0190.00816.11
5.6.50.0210.00615.98
5.6.40.0130.01316.18
5.6.30.0080.01516.02
5.6.20.0150.00916.11
5.6.10.0220.00815.94
5.6.00.0130.01216.05
5.5.380.0190.00616.16
5.5.370.0110.01416.07
5.5.360.0120.01616.09
5.5.350.0110.01416.02
5.5.340.0130.01716.06
5.5.330.0180.00915.92
5.5.320.0280.00616.13
5.5.310.0140.01416.14
5.5.300.0170.01016.16
5.5.290.0130.01315.97
5.5.280.0180.00616.06
5.5.270.0230.00316.07
5.5.260.0160.00615.87
5.5.250.0310.00316.06
5.5.240.0210.00316.06
5.5.230.0150.00815.94
5.5.220.0090.01415.94
5.5.210.0140.00816.13
5.5.200.0120.01215.98
5.5.190.0110.01215.95
5.5.180.0180.00615.87
5.5.170.0140.01815.75
5.5.160.0140.01415.90
5.5.150.0210.00615.76
5.5.140.0180.01115.93
5.5.130.0220.00715.61
5.5.120.0170.00815.84
5.5.110.0160.01015.62
5.5.100.0300.00315.89
5.5.90.0210.00516.05
5.5.80.0140.01015.91
5.5.70.0210.00615.93
5.5.60.0200.00416.09
5.5.50.0230.01715.98
5.5.40.0170.00815.89
5.5.30.0140.00915.95
5.5.20.0170.01315.96
5.5.10.0090.01815.91
5.5.00.0080.01715.99
5.4.450.0090.00912.71
5.4.440.0080.00812.77
5.4.430.0120.00612.80
5.4.420.0150.00412.76
5.4.410.0170.00312.91
5.4.400.0180.00012.71
5.4.390.0160.00512.61
5.4.380.0150.00912.64
5.4.370.0150.00512.69
5.4.360.0120.00612.64
5.4.350.0150.00812.63
5.4.340.0070.01112.65
5.4.330.0120.00912.67
5.4.320.0150.00612.76
5.4.310.0150.00912.75
5.4.300.0120.00612.77
5.4.290.0130.00912.61
5.4.280.0120.01212.70
5.4.270.0120.00712.71
5.4.260.0150.00512.55
5.4.250.0160.00412.62
5.4.240.0150.00412.65
5.4.230.0090.00912.38
5.4.220.0160.00312.43
5.4.210.0220.00012.45
5.4.200.0100.01012.45
5.4.190.0120.00612.47
5.4.180.0190.00312.43
5.4.170.0200.00312.48
5.4.160.0080.01212.58
5.4.150.0050.01412.54
5.4.140.0120.00812.71
5.4.130.0120.00912.72
5.4.120.0110.00712.69
5.4.110.0080.01112.88
5.4.100.0110.00712.75
5.4.90.0120.00812.69
5.4.80.0080.01212.78
5.4.70.0180.00912.78
5.4.60.0100.01012.75
5.4.50.0150.00412.74
5.4.40.0150.00312.66
5.4.30.0120.00812.93
5.4.20.0170.00212.79
5.4.10.0130.00712.80
5.4.00.0130.01012.60
5.3.290.0040.01713.30
5.3.280.0180.00913.32
5.3.270.0100.01013.24
5.3.260.0160.00813.41
5.3.250.0130.00913.34
5.3.240.0140.00613.35
5.3.230.0130.00713.31
5.3.220.0130.00712.96
5.3.210.0150.00413.25
5.3.200.0180.00413.14
5.3.190.0110.00813.02
5.3.180.0110.00813.49
5.3.170.0130.00713.28
5.3.160.0080.01213.28
5.3.150.0120.00813.14
5.3.140.0080.01113.13
5.3.130.0140.00613.13
5.3.120.0170.00613.22
5.3.110.0160.00613.23
5.3.100.0160.00613.31
5.3.90.0140.00713.07
5.3.80.0080.01113.06
5.3.70.0070.01113.08
5.3.60.0070.01513.12
5.3.50.0170.00313.14
5.3.40.0130.00913.18
5.3.30.0080.01213.21
5.3.20.0090.01313.13
5.3.10.0110.00813.25
5.3.00.0110.00812.92
5.2.170.0070.01111.93
5.2.160.0090.01212.00
5.2.150.0140.00212.20
5.2.140.0140.00712.02
5.2.130.0090.00911.93
5.2.120.0140.00611.75
5.2.110.0180.00011.85
5.2.100.0060.00911.87
5.2.90.0090.00611.89
5.2.80.0170.00011.86
5.2.70.0090.00711.70
5.2.60.0070.00811.79
5.2.50.0180.00311.72
5.2.40.0040.01511.89
5.2.30.0130.00311.83
5.2.20.0140.00311.63
5.2.10.0120.00611.63
5.2.00.0060.00911.43
5.1.60.0110.00811.24
5.1.50.0070.00711.24
5.1.40.0070.01111.24
5.1.30.0000.01511.24
5.1.20.0130.00011.24
5.1.10.0040.00811.24
5.1.00.0070.00711.24
5.0.50.0110.00411.24
5.0.40.0060.00611.24
5.0.30.0080.00411.24
5.0.20.0000.01111.24
5.0.10.0040.00811.24
5.0.00.0060.00611.24
4.4.90.0100.00011.24
4.4.80.0030.00411.24
4.4.70.0090.00211.24
4.4.60.0080.00011.24
4.4.50.0060.00211.24
4.4.40.0070.00211.24
4.4.30.0070.00011.24
4.4.20.0060.00011.24
4.4.10.0020.00511.24
4.4.00.0110.00711.24
4.3.110.0040.00211.24
4.3.100.0020.00511.24
4.3.90.0040.00211.24
4.3.80.0000.00911.24
4.3.70.0000.00811.24
4.3.60.0050.00311.24
4.3.50.0050.00211.24
4.3.40.0040.00411.24
4.3.30.0070.00011.24
4.3.20.0040.00411.24
4.3.10.0000.00911.24
4.3.00.0030.00511.24

preferences:
69.66 ms | 400 KiB | 5 Q