3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_timezone_offset($remote_tz, $origin_tz = null) { if($origin_tz === null) { if(!is_string($origin_tz = date_default_timezone_get())) { return false; // A UTC timestamp was returned -- bail out! } } $origin_dtz = new DateTimeZone($origin_tz); $remote_dtz = new DateTimeZone($remote_tz); $origin_dt = new DateTime("now", $origin_dtz); $remote_dt = new DateTime("now", $remote_dtz); $offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt); return $offset; } $offset = get_timezone_offset('America/Los_Angeles'); $offset_time = time() + $offset; echo $offset_time;

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)
7.4.10.0120.00816.71
7.4.00.0150.00416.69
7.3.130.0070.01316.77
7.3.120.0120.00616.70
7.3.110.0090.00916.57
7.3.100.0070.00716.79
7.3.90.0000.01116.68
7.3.80.0030.01316.85
7.3.70.0060.01216.65
7.3.60.0040.00416.74
7.3.50.0040.01116.71
7.3.40.0000.00916.64
7.3.30.0070.01016.57
7.3.20.0040.00818.49
7.3.10.0100.00018.35
7.3.00.0060.01218.40
7.2.260.0100.00616.67
7.2.250.0070.01416.85
7.2.240.0060.01217.01
7.2.230.0000.01416.85
7.2.220.0070.00416.86
7.2.210.0060.00916.84
7.2.200.0060.00616.73
7.2.190.0000.01116.64
7.2.180.0060.00616.65
7.2.170.0000.01616.71
7.2.160.0080.00416.75
7.2.150.0060.01018.60
7.2.140.0030.00718.46
7.2.130.0060.00918.84
7.2.120.0060.01018.61
7.2.110.0060.00618.59
7.2.100.0070.00718.61
7.2.90.0090.00618.63
7.2.80.0130.00318.42
7.2.70.0090.00618.65
7.2.60.0080.00818.71
7.2.50.0040.01218.47
7.2.40.0030.01418.65
7.2.30.0140.00318.66
7.2.20.0100.00618.67
7.2.10.0070.00718.61
7.2.00.0040.00819.18
7.1.330.0070.00717.74
7.1.320.0070.00717.66
7.1.310.0000.01117.61
7.1.300.0000.01417.62
7.1.290.0030.01617.59
7.1.280.0090.00317.44
7.1.270.0030.00717.59
7.1.260.0110.00717.59
7.1.250.0090.00917.57
7.1.240.0070.01117.46
7.1.230.0130.00317.61
7.1.220.0080.00317.57
7.1.210.0070.00717.47
7.1.200.0040.00916.63
7.1.190.0080.00817.41
7.1.180.0040.00717.55
7.1.170.0040.00717.45
7.1.160.0100.00717.66
7.1.150.0080.00817.57
7.1.140.0080.00617.57
7.1.130.0070.00717.60
7.1.120.0000.00917.63
7.1.110.0070.01117.68
7.1.100.0040.00918.08
7.1.90.0000.01317.56
7.1.80.0000.01217.75
7.1.70.0050.00717.54
7.1.60.0050.01418.63
7.1.50.0090.01217.40
7.1.40.0040.01217.45
7.1.30.0060.00317.58
7.1.20.0030.00917.67
7.1.10.0000.01517.73
7.1.00.0050.04320.04
7.0.330.0100.00717.29
7.0.320.0070.00717.15
7.0.310.0040.01117.20
7.0.300.0030.01017.23
7.0.290.0130.00017.27
7.0.280.0000.01417.26
7.0.270.0070.00717.16
7.0.260.0070.01017.10
7.0.250.0090.00617.16
7.0.240.0000.01017.26
7.0.230.0030.00617.29
7.0.220.0070.00717.14
7.0.210.0040.01117.41
7.0.200.0020.00717.19
7.0.190.0070.00317.02
7.0.180.0100.00317.25
7.0.170.0120.00417.21
7.0.160.0070.00717.42
7.0.150.0060.01217.32
7.0.140.0060.03619.59
7.0.130.0110.00317.31
7.0.120.0140.00317.35
7.0.110.0140.00317.14
7.0.100.0080.04518.58
7.0.90.0060.04818.69
7.0.80.0110.04018.52
7.0.70.0060.02618.57
7.0.60.0070.02418.58
7.0.50.0090.02518.81
7.0.40.0030.02717.64
7.0.30.0050.03517.50
7.0.20.0040.03917.68
7.0.10.0060.02817.56
7.0.00.0040.03417.74
5.6.400.0090.01215.95
5.6.390.0030.01416.16
5.6.380.0120.00016.08
5.6.370.0030.00616.08
5.6.360.0030.00916.38
5.6.350.0000.01316.08
5.6.340.0030.00616.30
5.6.330.0080.00416.07
5.6.320.0060.01016.10
5.6.310.0030.01316.19
5.6.300.0090.00916.00
5.6.290.0030.00616.07
5.6.280.0100.03518.63
5.6.270.0040.01116.08
5.6.260.0060.01216.09
5.6.250.0100.04218.50
5.6.240.0050.05018.30
5.6.230.0130.03818.33
5.6.220.0090.02218.27
5.6.210.0070.03918.40
5.6.200.0030.02618.57
5.6.190.0070.04018.53
5.6.180.0100.02018.55
5.6.170.0060.02218.42
5.6.160.0080.04018.60
5.6.150.0060.04218.50
5.6.140.0100.02318.56
5.6.130.0100.02318.58
5.6.120.0080.02518.64
5.6.110.0030.02218.53
5.6.100.0090.01818.56
5.6.90.0060.02318.48
5.6.80.0020.02818.15
5.6.70.0050.02918.36
5.6.60.0000.02618.13
5.6.50.0050.02318.12
5.6.40.0050.02518.13
5.6.30.0030.02618.06
5.6.20.0050.02518.23
5.6.10.0050.02718.19
5.6.00.0050.03518.16
5.5.380.0050.02818.17
5.5.370.0060.02318.15
5.5.360.0020.04218.22
5.5.350.0090.01818.21
5.5.340.0050.02418.43
5.5.330.0030.03018.44
5.5.320.0050.02518.33
5.5.310.0060.02318.35
5.5.300.0110.02118.37
5.5.290.0020.02618.40
5.5.280.0080.02718.35
5.5.270.0020.02818.48
5.5.260.0080.02218.26
5.5.250.0030.02318.29
5.5.240.0050.02218.00
5.5.230.0030.02918.04
5.5.220.0080.02017.99
5.5.210.0040.02618.06
5.5.200.0100.01718.07
5.5.190.0030.02617.93
5.5.180.0090.02017.99
5.5.170.0030.00915.85
5.5.160.0070.02218.04
5.5.150.0080.03318.16
5.5.140.0040.04517.93
5.5.130.0020.04518.00
5.5.120.0070.04118.09
5.5.110.0050.03618.02
5.5.100.0030.02717.98
5.5.90.0030.02717.89
5.5.80.0050.02618.00
5.5.70.0070.04417.91
5.5.60.0050.02817.99
5.5.50.0070.03917.77
5.5.40.0050.04818.00
5.5.30.0070.04518.02
5.5.20.0040.04217.85
5.5.10.0100.04018.02
5.5.00.0070.02518.00
5.4.450.0020.02416.21
5.4.440.0050.01916.08
5.4.430.0070.02116.06
5.4.420.0050.03316.04
5.4.410.0030.02016.07
5.4.400.0020.02515.96
5.4.390.0020.02215.91
5.4.380.0080.01815.85
5.4.370.0080.01716.06
5.4.360.0080.01715.84
5.4.350.0000.02615.80
5.4.340.0090.01715.93
5.4.330.0000.01112.79
5.4.320.0050.02015.97
5.4.310.0050.02115.74
5.4.300.0000.03315.98
5.4.290.0090.02216.00
5.4.280.0070.04215.90
5.4.270.0070.03215.89
5.4.260.0020.02615.97
5.4.250.0000.03915.88
5.4.240.0080.03815.85
5.4.230.0030.02815.99
5.4.220.0050.02315.98
5.4.210.0030.04515.96
5.4.200.0130.03816.01
5.4.190.0040.02615.96
5.4.180.0060.04615.84
5.4.170.0130.03815.85
5.4.160.0070.02315.77
5.4.150.0080.03816.02
5.4.140.0080.03614.61
5.4.130.0090.03614.54
5.4.120.0030.02914.55
5.4.110.0050.03814.46
5.4.100.0000.03514.59
5.4.90.0030.02514.69
5.4.80.0130.02614.52
5.4.70.0050.02914.62
5.4.60.0070.03814.68
5.4.50.0090.04114.69
5.4.40.0050.04214.47
5.4.30.0030.04714.54
5.4.20.0000.03214.57
5.4.10.0020.04414.54
5.4.00.0020.02514.20
5.3.290.0050.02214.08
5.3.280.0050.04313.97
5.3.270.0080.04014.05
5.3.260.0000.05114.08
5.3.250.0100.04013.88
5.3.240.0050.03013.84
5.3.230.0000.03913.95
5.3.220.0060.04013.86
5.3.210.0030.03913.87
5.3.200.0040.03713.80
5.3.190.0050.02513.85
5.3.180.0050.02813.88
5.3.170.0070.03313.98
5.3.160.0080.03613.88
5.3.150.0070.03713.91
5.3.140.0050.04313.90
5.3.130.0080.03613.91
5.3.120.0030.04113.85
5.3.110.0070.02513.84
5.3.100.0060.03513.78
5.3.90.0050.04013.71
5.3.80.0030.04313.68
5.3.70.0070.03913.67
5.3.60.0030.02813.52
5.3.50.0050.03913.57
5.3.40.0020.02313.62
5.3.30.0050.04513.62
5.3.20.0030.03913.43
5.3.10.0050.04013.41
5.3.00.0060.03113.38
5.2.170.0000.04011.20
5.2.160.0070.03011.13
5.2.150.0000.03711.03
5.2.140.0070.04711.24
5.2.130.0030.05711.01
5.2.120.0000.03711.24
5.2.110.0070.05011.01
5.2.100.0070.02311.20
5.2.90.0000.03011.13
5.2.80.0070.02711.22
5.2.70.0100.06011.18
5.2.60.0070.04011.07
5.2.50.0000.05711.11
5.2.40.0030.05310.86
5.2.30.0000.07011.02
5.2.20.0100.05310.84
5.2.10.0070.05010.78
5.2.00.0000.06010.80
5.1.60.0070.03010.09
5.1.50.0100.0479.83
5.1.40.0030.0539.98
5.1.30.0030.06010.43
5.1.20.0030.05710.21
5.1.10.0030.05310.13
5.1.00.0000.05710.06
5.0.50.0030.0438.63
5.0.40.0070.0408.27
5.0.30.0070.0408.09
5.0.20.0000.0478.21
5.0.10.0170.0378.29
5.0.00.0070.0608.25
4.4.90.0030.0307.26
4.4.80.0070.0307.26
4.4.70.0000.0277.26
4.4.60.0000.0407.26
4.4.50.0030.0337.26
4.4.40.0030.0537.26
4.4.30.0030.0337.26
4.4.20.0100.0307.26
4.4.10.0000.0237.26
4.4.00.0030.0377.26
4.3.110.0030.0337.26
4.3.100.0030.0207.26
4.3.90.0070.0307.26
4.3.80.0030.0507.26
4.3.70.0000.0377.26
4.3.60.0000.0337.26
4.3.50.0000.0377.26
4.3.40.0000.0477.26
4.3.30.0070.0207.26
4.3.20.0030.0307.26
4.3.10.0030.0237.26
4.3.00.0030.0337.26

preferences:
35.38 ms | 401 KiB | 5 Q