3v4l.org

run code in 300+ PHP versions simultaneously
<?php function icsToArray($paramUrl) { $icsFile = file_get_contents($paramUrl); $icsData = explode("BEGIN:VEVENT", $icsFile); foreach($icsData as $key => $value) { $icsDatesMeta[$key] = explode("\n", $value); } foreach($icsDatesMeta as $key => $value) { foreach($value as $subKey => $subValue) { if ($subValue != "") { if ($key != 0 && $subKey == 0) { $icsDates[$key]["BEGIN"] = $subValue; } else { $subValueArr = explode(":", $subValue, 2); $icsDates[$key][$subValueArr[0]] = $subValueArr[1]; } } } } return $icsDates; } function toDB($array) { $data = array(); $number = 0; foreach ($array as $ent) { if ($number == 0) { $number++; continue; } $arr = array(); $arr['START'] = $array['DTSTART;TZID=Australia/Melbourne']; $arr['END'] = $array['DTEND;TZID=Australia/Melbourne']; $arr['LOCATION'] = $array['LOCATION']; $arr['NAME'] = $array['SUMMARY']; $arr['DESCRIPTION'] = $array['DESCRIPTION']; array_push($data, $arr); } return $data; } print_r(toDB(icsToArray("http://mysubjects.uts.edu.au/aplus2015/rest/calendar/ical/bc269a33-1471-4872-aad6-ba4851bbb0c1.ics"))); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PDU0j
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'todb'
          2        INIT_FCALL                                               'icstoarray'
          3        SEND_VAL                                                 'http%3A%2F%2Fmysubjects.uts.edu.au%2Faplus2015%2Frest%2Fcalendar%2Fical%2Fbc269a33-1471-4872-aad6-ba4851bbb0c1.ics'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                                 
   50     9      > RETURN                                                   1

Function icstoarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 52
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 52
Branch analysis from position: 23
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 50
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 50
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 49
Branch analysis from position: 29
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 38
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 33
Branch analysis from position: 49
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 50
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 20
filename:       /in/PDU0j
function name:  icsToArray
number of ops:  55
compiled vars:  !0 = $paramUrl, !1 = $icsFile, !2 = $icsData, !3 = $value, !4 = $key, !5 = $icsDatesMeta, !6 = $subValue, !7 = $subKey, !8 = $icsDates, !9 = $subValueArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'file_get_contents'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $10     
          4        ASSIGN                                                   !1, $10
    5     5        INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 'BEGIN%3AVEVENT'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $12     
          9        ASSIGN                                                   !2, $12
    7    10      > FE_RESET_R                                       $14     !2, ->20
         11    > > FE_FETCH_R                                       ~15     $14, !3, ->20
         12    >   ASSIGN                                                   !4, ~15
    8    13        INIT_FCALL                                               'explode'
         14        SEND_VAL                                                 '%0A'
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $18     
         17        ASSIGN_DIM                                               !5, !4
         18        OP_DATA                                                  $18
    7    19      > JMP                                                      ->11
         20    >   FE_FREE                                                  $14
   11    21      > FE_RESET_R                                       $19     !5, ->52
         22    > > FE_FETCH_R                                       ~20     $19, !3, ->52
         23    >   ASSIGN                                                   !4, ~20
   12    24      > FE_RESET_R                                       $22     !3, ->50
         25    > > FE_FETCH_R                                       ~23     $22, !6, ->50
         26    >   ASSIGN                                                   !7, ~23
   13    27        IS_NOT_EQUAL                                             !6, ''
         28      > JMPZ                                                     ~25, ->49
   14    29    >   IS_NOT_EQUAL                                     ~26     !4, 0
         30      > JMPZ_EX                                          ~26     ~26, ->33
         31    >   IS_EQUAL                                         ~27     !7, 0
         32        BOOL                                             ~26     ~27
         33    > > JMPZ                                                     ~26, ->38
   15    34    >   FETCH_DIM_W                                      $28     !8, !4
         35        ASSIGN_DIM                                               $28, 'BEGIN'
         36        OP_DATA                                                  !6
         37      > JMP                                                      ->49
   17    38    >   INIT_FCALL                                               'explode'
         39        SEND_VAL                                                 '%3A'
         40        SEND_VAR                                                 !6
         41        SEND_VAL                                                 2
         42        DO_ICALL                                         $30     
         43        ASSIGN                                                   !9, $30
   18    44        FETCH_DIM_R                                      ~33     !9, 0
         45        FETCH_DIM_R                                      ~35     !9, 1
         46        FETCH_DIM_W                                      $32     !8, !4
         47        ASSIGN_DIM                                               $32, ~33
         48        OP_DATA                                                  ~35
   12    49    > > JMP                                                      ->25
         50    >   FE_FREE                                                  $22
   11    51      > JMP                                                      ->22
         52    >   FE_FREE                                                  $19
   24    53      > RETURN                                                   !8
   25    54*     > RETURN                                                   null

End of function icstoarray

Function todb:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 30
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 30
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/PDU0j
function name:  toDB
number of ops:  33
compiled vars:  !0 = $array, !1 = $data, !2 = $number, !3 = $ent, !4 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   29     1        ASSIGN                                                   !1, <array>
   30     2        ASSIGN                                                   !2, 0
   31     3      > FE_RESET_R                                       $7      !0, ->30
          4    > > FE_FETCH_R                                               $7, !3, ->30
   33     5    >   IS_EQUAL                                                 !2, 0
          6      > JMPZ                                                     ~8, ->9
   34     7    >   PRE_INC                                                  !2
   35     8      > JMP                                                      ->4
   37     9    >   ASSIGN                                                   !4, <array>
   38    10        FETCH_DIM_R                                      ~12     !0, 'DTSTART%3BTZID%3DAustralia%2FMelbourne'
         11        ASSIGN_DIM                                               !4, 'START'
         12        OP_DATA                                                  ~12
   39    13        FETCH_DIM_R                                      ~14     !0, 'DTEND%3BTZID%3DAustralia%2FMelbourne'
         14        ASSIGN_DIM                                               !4, 'END'
         15        OP_DATA                                                  ~14
   40    16        FETCH_DIM_R                                      ~16     !0, 'LOCATION'
         17        ASSIGN_DIM                                               !4, 'LOCATION'
         18        OP_DATA                                                  ~16
   41    19        FETCH_DIM_R                                      ~18     !0, 'SUMMARY'
         20        ASSIGN_DIM                                               !4, 'NAME'
         21        OP_DATA                                                  ~18
   42    22        FETCH_DIM_R                                      ~20     !0, 'DESCRIPTION'
         23        ASSIGN_DIM                                               !4, 'DESCRIPTION'
         24        OP_DATA                                                  ~20
   43    25        INIT_FCALL                                               'array_push'
         26        SEND_REF                                                 !1
         27        SEND_VAR                                                 !4
         28        DO_ICALL                                                 
   31    29      > JMP                                                      ->4
         30    >   FE_FREE                                                  $7
   45    31      > RETURN                                                   !1
   47    32*     > RETURN                                                   null

End of function todb

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.56 ms | 1407 KiB | 23 Q