3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/Berlin'); function getsuntimes($sunrisemin,$sunsetmin){ $result = file_get_contents('http://weather.yahooapis.com/forecastrss?w=12835286&u=c'); $xml = simplexml_load_string($result); $xml->registerXPathNamespace('yweather', 'http://xml.weather.yahoo.com/ns/rss/1.0'); $astronomy = $xml->channel->xpath('yweather:astronomy'); $sunrise = $astronomy[0]['sunrise']; $sunset = $astronomy[0]['sunset']; $sunrise = date("G:i", strtotime($sunrise)); $sunset = date("G:i", strtotime($sunset)); $dt = DateTime::createFromFormat('H:i', $sunrise); if ($sunrisemin > 0) { $dt->add(new DateInterval('PT'.$sunrisemin.'M')); } else { $sunrisemin = str_replace('-','',$sunrisemin); $dt->sub(new DateInterval('PT'.$sunrisemin.'M')); } $sunrisemod = $dt->format('H:i'); $dt = DateTime::createFromFormat('H:i', $sunset); if ($sunsetmin > 0) { $dt->add(new DateInterval('PT'.$sunsetmin.'M')); } else { $sunsetmin = str_replace('-','',$sunsetmin); $dt->sub(new DateInterval('PT'.$sunsetmin.'M')); } $sunsetmod = $dt->format('H:i'); $output['sunrise'] = $sunrisemod; $output['sunset'] = $sunsetmod; return $output; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TA9jI
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'Europe%2FBerlin'
          2        DO_ICALL                                                 
   39     3      > RETURN                                                   1

Function getsuntimes:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 57
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 82, Position 2 = 91
Branch analysis from position: 82
1 jumps found. (Code = 42) Position 1 = 105
Branch analysis from position: 105
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 91
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 82, Position 2 = 91
Branch analysis from position: 82
Branch analysis from position: 91
filename:       /in/TA9jI
function name:  getsuntimes
number of ops:  115
compiled vars:  !0 = $sunrisemin, !1 = $sunsetmin, !2 = $result, !3 = $xml, !4 = $astronomy, !5 = $sunrise, !6 = $sunset, !7 = $dt, !8 = $sunrisemod, !9 = $sunsetmod, !10 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'file_get_contents'
          3        SEND_VAL                                                 'http%3A%2F%2Fweather.yahooapis.com%2Fforecastrss%3Fw%3D12835286%26u%3Dc'
          4        DO_ICALL                                         $11     
          5        ASSIGN                                                   !2, $11
    6     6        INIT_FCALL                                               'simplexml_load_string'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $13     
          9        ASSIGN                                                   !3, $13
    7    10        INIT_METHOD_CALL                                         !3, 'registerXPathNamespace'
         11        SEND_VAL_EX                                              'yweather'
         12        SEND_VAL_EX                                              'http%3A%2F%2Fxml.weather.yahoo.com%2Fns%2Frss%2F1.0'
         13        DO_FCALL                                      0          
    8    14        FETCH_OBJ_R                                      ~16     !3, 'channel'
         15        INIT_METHOD_CALL                                         ~16, 'xpath'
         16        SEND_VAL_EX                                              'yweather%3Aastronomy'
         17        DO_FCALL                                      0  $17     
         18        ASSIGN                                                   !4, $17
   10    19        FETCH_DIM_R                                      ~19     !4, 0
         20        FETCH_DIM_R                                      ~20     ~19, 'sunrise'
         21        ASSIGN                                                   !5, ~20
   11    22        FETCH_DIM_R                                      ~22     !4, 0
         23        FETCH_DIM_R                                      ~23     ~22, 'sunset'
         24        ASSIGN                                                   !6, ~23
   13    25        INIT_FCALL                                               'date'
         26        SEND_VAL                                                 'G%3Ai'
         27        INIT_FCALL                                               'strtotime'
         28        SEND_VAR                                                 !5
         29        DO_ICALL                                         $25     
         30        SEND_VAR                                                 $25
         31        DO_ICALL                                         $26     
         32        ASSIGN                                                   !5, $26
   14    33        INIT_FCALL                                               'date'
         34        SEND_VAL                                                 'G%3Ai'
         35        INIT_FCALL                                               'strtotime'
         36        SEND_VAR                                                 !6
         37        DO_ICALL                                         $28     
         38        SEND_VAR                                                 $28
         39        DO_ICALL                                         $29     
         40        ASSIGN                                                   !6, $29
   17    41        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         42        SEND_VAL                                                 'H%3Ai'
         43        SEND_VAR                                                 !5
         44        DO_FCALL                                      0  $31     
         45        ASSIGN                                                   !7, $31
   18    46        IS_SMALLER                                               0, !0
         47      > JMPZ                                                     ~33, ->57
   19    48    >   INIT_METHOD_CALL                                         !7, 'add'
         49        NEW                                              $34     'DateInterval'
         50        CONCAT                                           ~35     'PT', !0
         51        CONCAT                                           ~36     ~35, 'M'
         52        SEND_VAL_EX                                              ~36
         53        DO_FCALL                                      0          
         54        SEND_VAR_NO_REF_EX                                       $34
         55        DO_FCALL                                      0          
         56      > JMP                                                      ->71
   21    57    >   INIT_FCALL                                               'str_replace'
         58        SEND_VAL                                                 '-'
         59        SEND_VAL                                                 ''
         60        SEND_VAR                                                 !0
         61        DO_ICALL                                         $39     
         62        ASSIGN                                                   !0, $39
   22    63        INIT_METHOD_CALL                                         !7, 'sub'
         64        NEW                                              $41     'DateInterval'
         65        CONCAT                                           ~42     'PT', !0
         66        CONCAT                                           ~43     ~42, 'M'
         67        SEND_VAL_EX                                              ~43
         68        DO_FCALL                                      0          
         69        SEND_VAR_NO_REF_EX                                       $41
         70        DO_FCALL                                      0          
   24    71    >   INIT_METHOD_CALL                                         !7, 'format'
         72        SEND_VAL_EX                                              'H%3Ai'
         73        DO_FCALL                                      0  $46     
         74        ASSIGN                                                   !8, $46
   26    75        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         76        SEND_VAL                                                 'H%3Ai'
         77        SEND_VAR                                                 !6
         78        DO_FCALL                                      0  $48     
         79        ASSIGN                                                   !7, $48
   27    80        IS_SMALLER                                               0, !1
         81      > JMPZ                                                     ~50, ->91
   28    82    >   INIT_METHOD_CALL                                         !7, 'add'
         83        NEW                                              $51     'DateInterval'
         84        CONCAT                                           ~52     'PT', !1
         85        CONCAT                                           ~53     ~52, 'M'
         86        SEND_VAL_EX                                              ~53
         87        DO_FCALL                                      0          
         88        SEND_VAR_NO_REF_EX                                       $51
         89        DO_FCALL                                      0          
         90      > JMP                                                      ->105
   30    91    >   INIT_FCALL                                               'str_replace'
         92        SEND_VAL                                                 '-'
         93        SEND_VAL                                                 ''
         94        SEND_VAR                                                 !1
         95        DO_ICALL                                         $56     
         96        ASSIGN                                                   !1, $56
   31    97        INIT_METHOD_CALL                                         !7, 'sub'
         98        NEW                                              $58     'DateInterval'
         99        CONCAT                                           ~59     'PT', !1
        100        CONCAT                                           ~60     ~59, 'M'
        101        SEND_VAL_EX                                              ~60
        102        DO_FCALL                                      0          
        103        SEND_VAR_NO_REF_EX                                       $58
        104        DO_FCALL                                      0          
   33   105    >   INIT_METHOD_CALL                                         !7, 'format'
        106        SEND_VAL_EX                                              'H%3Ai'
        107        DO_FCALL                                      0  $63     
        108        ASSIGN                                                   !9, $63
   35   109        ASSIGN_DIM                                               !10, 'sunrise'
        110        OP_DATA                                                  !8
   36   111        ASSIGN_DIM                                               !10, 'sunset'
        112        OP_DATA                                                  !9
   37   113      > RETURN                                                   !10
   38   114*     > RETURN                                                   null

End of function getsuntimes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.47 ms | 1404 KiB | 25 Q