3v4l.org

run code in 300+ PHP versions simultaneously
<?php function timeZoneToOffset(DateTimeZone $timezone) { return (new \DateTime('now', $timezone))->format('P'); } $timezone1 = new DateTimeZone('Europe/Paris'); $d1 = new DateTimeImmutable('2020-01-01 15:00 ' . timeZoneToOffset($timezone1)); $timezone2 = new DateTimeZone('Africa/Cairo'); $d2 = new DateTimeImmutable('2020-01-01 15:00 ' . timeZoneToOffset($timezone2)); var_dump($d1->getTimestamp() === $d2->getTimestamp());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5JAvE
function name:  (null)
number of ops:  33
compiled vars:  !0 = $timezone1, !1 = $d1, !2 = $timezone2, !3 = $d2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $4      'DateTimeZone'
          1        SEND_VAL_EX                                              'Europe%2FParis'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
    8     4        NEW                                              $7      'DateTimeImmutable'
          5        INIT_FCALL                                               'timezonetooffset'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $8      
          8        CONCAT                                           ~9      '2020-01-01+15%3A00+', $8
          9        SEND_VAL_EX                                              ~9
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $7
    9    12        NEW                                              $12     'DateTimeZone'
         13        SEND_VAL_EX                                              'Africa%2FCairo'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !2, $12
   10    16        NEW                                              $15     'DateTimeImmutable'
         17        INIT_FCALL                                               'timezonetooffset'
         18        SEND_VAR                                                 !2
         19        DO_FCALL                                      0  $16     
         20        CONCAT                                           ~17     '2020-01-01+15%3A00+', $16
         21        SEND_VAL_EX                                              ~17
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !3, $15
   11    24        INIT_FCALL                                               'var_dump'
         25        INIT_METHOD_CALL                                         !1, 'getTimestamp'
         26        DO_FCALL                                      0  $20     
         27        INIT_METHOD_CALL                                         !3, 'getTimestamp'
         28        DO_FCALL                                      0  $21     
         29        IS_IDENTICAL                                     ~22     $20, $21
         30        SEND_VAL                                                 ~22
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Function timezonetooffset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5JAvE
function name:  timeZoneToOffset
number of ops:  10
compiled vars:  !0 = $timezone
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        NEW                                              $1      'DateTime'
          2        SEND_VAL_EX                                              'now'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $1, 'format'
          6        SEND_VAL_EX                                              'P'
          7        DO_FCALL                                      0  $3      
          8      > RETURN                                                   $3
    5     9*     > RETURN                                                   null

End of function timezonetooffset

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.63 ms | 1007 KiB | 16 Q