3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = '2015-01-01T00:00:00.000Z'; echo "================================================================\n Trying to set a DateTimeZone using a date with a timezone\n DATE: {$date}\n"; echo "DateTimeZone will be ignored because date has a timezone 'Z'\n"; $dateTime = new DateTime($date, new DateTimeZone('America/Mexico_City')); echo $dateTime->format('c'). "\n\n"; echo "DateTimeZone will be ignored, date timezone is in UTC anyway!\n"; $dateTime = new DateTime($date, new DateTimeZone('UTC')); echo $dateTime->format('c'). "\n\n"; $date = '2015-01-01T00:00:00.000'; echo "================================================================\n Trying to set a DateTimeZone using a date with NO timezone\n DATE: {$date}\n"; echo "Timezone will be set to the given DateTimeZone America/Mexico_City\n"; $dateTime = new DateTime($date, new DateTimeZone('America/Mexico_City')); echo $dateTime->format('c'). "\n\n"; echo "Timezone will be set to the given DateTimeZone UTC\n"; $dateTime = new DateTime($date, new DateTimeZone('UTC')); echo $dateTime->format('c'). "\n\n"; $date = '2015-01-01T00:00:00.000 America/Mexico_City'; echo "================================================================\n Trying to set a timezone directly in the date\n DATE: {$date}\n"; echo "DATE: {$date}\n\n"; echo "Timezone will set to the given timezone set in the date string America/Mexico_City\n"; $dateTime = new DateTime($date); echo $dateTime->format('c'). "\n\n"; $date = '2015-01-01T00:00:00.000'; echo "================================================================\n DateTimeZone: setting it in construct vs setTimezone method\n DATE: {$date}\n"; echo "Set timezone using construct:\n"; $dateTime = new DateTime($date, new DateTimeZone('America/Mexico_City')); echo $dateTime->format('c'). "\n\n"; echo "Set timezone using method:\n"; $dateTime = new DateTime($date); $dateTime->setTimezone(new DateTimeZone('America/Mexico_City')); echo $dateTime->format('c'). "\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.3.60.0070.00716.88
8.3.50.0120.00619.97
8.3.40.0110.00719.36
8.3.30.0070.00719.50
8.3.20.0100.00620.54
8.3.10.0050.00323.94
8.3.00.0040.00417.96
8.2.180.0080.00817.25
8.2.170.0080.00822.96
8.2.160.0110.00420.78
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00421.09
8.2.110.0060.00319.63
8.2.100.0000.01118.34
8.2.90.0000.00819.46
8.2.80.0090.00018.00
8.2.70.0000.00818.00
8.2.60.0000.00818.28
8.2.50.0050.00318.13
8.2.40.0090.00020.14
8.2.30.0040.00418.41
8.2.20.0080.00018.08
8.2.10.0040.00418.67
8.2.00.0040.00418.20
8.1.280.0040.01225.92
8.1.270.0050.00524.22
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0030.00624.12
8.1.230.0070.00318.08
8.1.220.0040.00418.02
8.1.210.0000.00818.77
8.1.200.0060.00317.73
8.1.190.0000.00817.73
8.1.180.0050.00318.10
8.1.170.0050.00318.96
8.1.160.0040.00422.25
8.1.150.0000.00719.28
8.1.140.0040.00417.91
8.1.130.0030.00318.37
8.1.120.0040.00418.04
8.1.110.0030.00517.96
8.1.100.0040.00417.96
8.1.90.0080.00018.02
8.1.80.0070.00018.00
8.1.70.0030.00317.84
8.1.60.0000.00818.06
8.1.50.0000.00918.00
8.1.40.0080.00017.98
8.1.30.0000.00818.04
8.1.20.0040.00418.16
8.1.10.0040.00418.02
8.1.00.0000.00818.09
8.0.300.0040.00418.77
8.0.290.0090.00017.25
8.0.280.0000.00718.89
8.0.270.0040.00417.60
8.0.260.0070.00017.71
8.0.250.0000.00717.49
8.0.240.0030.00317.58
8.0.230.0040.00417.41
8.0.220.0030.00317.50
8.0.210.0000.00717.48
8.0.200.0070.00017.51
8.0.190.0100.00017.49
8.0.180.0040.00417.43
8.0.170.0040.00417.43
8.0.160.0000.00717.50
8.0.150.0040.00417.43
8.0.140.0070.00017.39
8.0.130.0000.00613.84
8.0.120.0000.00717.35
8.0.110.0040.00417.37
8.0.100.0000.00817.41
8.0.90.0050.00317.35
8.0.80.0000.01517.32
8.0.70.0040.00417.46
8.0.60.0000.00717.50
8.0.50.0000.00817.48
8.0.30.0100.01217.53
8.0.20.0050.01517.47
8.0.10.0040.00417.45
8.0.00.0060.01317.05
7.4.330.0060.00015.32
7.4.320.0040.00417.05
7.4.300.0000.00716.89
7.4.290.0050.00216.79
7.4.280.0000.01017.04
7.4.270.0030.00317.04
7.4.260.0000.00716.92
7.4.250.0060.00316.95
7.4.240.0000.00816.90
7.4.230.0030.00516.94
7.4.220.0070.01116.92
7.4.210.0060.00916.98
7.4.200.0020.00517.11
7.4.160.0120.00616.78
7.4.150.0040.01317.40
7.4.140.0160.00617.86
7.4.130.0090.00916.73
7.4.120.0060.01216.92
7.4.110.0060.01316.92
7.4.100.0200.00516.80
7.4.90.0040.01316.82
7.4.80.0080.01119.39
7.4.70.0150.00316.88
7.4.60.0130.00416.89
7.4.50.0040.00416.92
7.4.40.0130.00316.96
7.4.30.0090.00616.84
7.4.00.0040.01115.26
7.3.330.0060.00313.57
7.3.320.0030.00313.66
7.3.310.0070.00016.64
7.3.300.0030.00516.71
7.3.290.0040.01516.77
7.3.280.0080.00916.74
7.3.270.0040.01417.40
7.3.260.0000.01816.89
7.3.250.0080.01016.79
7.3.240.0040.01416.86
7.3.230.0100.00716.77
7.3.210.0120.00617.06
7.3.200.0090.00919.39
7.3.190.0130.00316.70
7.3.180.0000.01616.79
7.3.170.0090.01516.81
7.3.160.0060.01017.11
7.3.120.0100.00315.16
7.3.110.0030.00715.26
7.3.100.0070.00715.31
7.3.90.0030.01315.16
7.3.80.0040.01115.25
7.3.70.0040.01115.27
7.3.60.0120.00315.04
7.3.50.0140.00015.30
7.3.40.0110.00314.96
7.3.30.0030.00915.14
7.3.20.0090.00916.95
7.3.10.0080.00316.98
7.3.00.0040.01116.84
7.2.330.0100.00716.78
7.2.320.0100.00617.25
7.2.310.0120.00917.02
7.2.300.0180.00317.20
7.2.290.0070.01016.77
7.2.240.0040.01115.52
7.2.230.0030.01015.68
7.2.220.0000.01615.71
7.2.210.0030.01415.58
7.2.200.0070.01015.74
7.2.190.0000.01515.44
7.2.180.0030.01315.66
7.2.170.0030.01215.37
7.2.160.0030.01315.16
7.2.150.0000.01517.04
7.2.140.0110.00717.46
7.2.130.0050.00817.25
7.2.120.0100.00717.26
7.2.110.0050.00717.40
7.2.100.0040.00917.36
7.2.90.0050.01117.47
7.2.80.0080.00817.26
7.2.70.0070.00717.36
7.2.60.0040.01217.32
7.2.50.0100.00617.46
7.2.40.0050.01017.33
7.2.30.0030.01217.41
7.2.20.0080.00817.30
7.2.10.0090.00517.40
7.2.00.0070.00818.27
7.1.330.0070.00716.07
7.1.320.0060.00915.88
7.1.310.0060.00915.70
7.1.300.0030.01015.72
7.1.290.0030.01015.92
7.1.280.0070.01015.77
7.1.270.0030.00715.71
7.1.260.0000.01615.72
7.1.250.0070.00515.87
7.1.100.0070.00718.25
7.1.70.0070.00017.41
7.1.60.0100.01419.40
7.1.50.0100.00716.88
7.1.00.0000.08022.28
7.0.200.0060.00615.34
7.0.140.0000.07322.05
7.0.60.0100.08320.01
7.0.50.0100.06317.70
7.0.40.0030.05020.14
7.0.30.0230.07720.14
7.0.20.0200.04320.12
7.0.10.0000.04720.19
7.0.00.0130.05320.00
5.6.280.0030.07321.09
5.6.210.0100.07720.48
5.6.200.0100.06318.15
5.6.190.0070.04720.43
5.6.180.0370.04320.46
5.6.170.0200.07320.55
5.6.160.0070.08320.33
5.6.150.0000.09018.24
5.6.140.0100.03718.18
5.6.130.0070.08318.21
5.6.120.0030.04321.11
5.6.110.0170.07020.96
5.6.100.0170.07021.05
5.6.90.0030.06020.89
5.6.80.0170.07320.37
5.5.350.0200.06320.45
5.5.340.0030.08317.88
5.5.330.0030.04320.14
5.5.320.0200.03720.29
5.5.310.0300.07720.21
5.5.300.0000.04017.89
5.5.290.0100.07718.01
5.5.280.0000.04320.86
5.5.270.0070.07020.75
5.5.260.0030.07720.69
5.5.250.0170.06720.66
5.5.240.0070.05720.25
5.4.450.0900.05719.58
5.4.440.0630.05719.48
5.4.430.0570.05019.53
5.4.420.0670.05719.27
5.4.410.0200.04318.96
5.4.400.3630.06018.79
5.4.390.0330.07318.69
5.4.380.0100.05018.75
5.4.370.0070.04718.47
5.4.360.0070.04018.57
5.4.350.0070.03711.99
5.4.340.0050.04511.99
5.4.320.0060.03912.48
5.4.310.0080.04312.47
5.4.300.0090.03512.48
5.4.290.0090.04212.48
5.4.280.0080.04712.38
5.4.270.0100.03612.38
5.4.260.0110.04612.38
5.4.250.0060.04412.38
5.4.240.0080.04312.37
5.4.230.0110.03912.37
5.4.220.0070.04312.37
5.4.210.0070.03412.37
5.4.200.0070.03612.36
5.4.190.0020.03912.36
5.4.180.0060.05012.36
5.4.170.0040.03812.37
5.4.160.0050.03612.37
5.4.150.0060.03512.37
5.4.140.0040.03812.05
5.4.130.0040.03812.04
5.4.120.0060.03411.99
5.4.110.0040.03811.99
5.4.100.0070.04011.99
5.4.90.0070.04011.99
5.4.80.0050.03811.99
5.4.70.0050.03511.99
5.4.60.0030.03711.99
5.4.50.0070.03911.99
5.4.40.0070.03611.98
5.4.30.0040.03711.97
5.4.20.0080.03911.97
5.4.10.0080.03211.98
5.4.00.0100.03311.46
5.3.290.0050.04512.80
5.3.280.0050.04312.71
5.3.270.0040.04312.72
5.3.260.0070.04512.72
5.3.250.0090.03912.72
5.3.240.0050.04012.72
5.3.230.0030.04312.71
5.3.220.0060.04512.68
5.3.210.0040.04412.68
5.3.200.0040.04012.68
5.3.190.0090.03412.67
5.3.180.0050.03712.67
5.3.170.0040.03812.66
5.3.160.0070.04112.67
5.3.150.0060.04412.67
5.3.140.0060.04112.66
5.3.130.0040.04212.66
5.3.120.0050.04312.66
5.3.110.0090.04212.66
5.3.100.0080.03812.12
5.3.90.0050.04612.09
5.3.80.0110.03512.08
5.3.70.0080.04512.08
5.3.60.0070.04112.06
5.3.50.0080.03812.02
5.3.40.0060.04412.01
5.3.30.0120.04711.97
5.3.20.0100.04211.75
5.3.10.0080.03711.71
5.3.00.0050.03811.71
5.2.170.0050.0319.21
5.2.160.0090.0279.21
5.2.150.0080.0289.21
5.2.140.0080.0279.21
5.2.130.0040.0299.17
5.2.120.0030.0299.16
5.2.110.0040.0319.17
5.2.100.0050.0299.17
5.2.90.0070.0359.17
5.2.80.0050.0319.17
5.2.70.0040.0329.17
5.2.60.0050.0309.12
5.2.50.0040.0329.09
5.2.40.0040.0299.07
5.2.30.0050.0299.05
5.2.20.0050.0299.04
5.2.10.0070.0268.96
5.2.00.0070.0318.82
5.1.60.0030.0248.10
5.1.50.0040.0258.10
5.1.40.0050.0238.08
5.1.30.0050.0258.43
5.1.20.0060.0258.45
5.1.10.0040.0258.17
5.1.00.0020.0278.18
5.0.50.0080.0236.65
5.0.40.0030.0226.52
5.0.30.0030.0356.34
5.0.20.0030.0206.30
5.0.10.0050.0256.28
5.0.00.0050.0306.27
4.4.90.0030.0174.78
4.4.80.0040.0174.76
4.4.70.0020.0164.75
4.4.60.0010.0174.76
4.4.50.0020.0174.77
4.4.40.0030.0254.71
4.4.30.0000.0234.76
4.4.20.0070.0114.85
4.4.10.0030.0154.84
4.4.00.0040.0314.76
4.3.110.0030.0154.67
4.3.100.0030.0144.67
4.3.90.0020.0154.64
4.3.80.0020.0304.59
4.3.70.0030.0204.63
4.3.60.0030.0194.62
4.3.50.0030.0194.62
4.3.40.0020.0264.54
4.3.30.0050.0223.32
4.3.20.0050.0143.30
4.3.10.0040.0143.25
4.3.00.0130.0277.14

preferences:
44.99 ms | 400 KiB | 5 Q