3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = <<<DATA <file_allegati> <allegato id="0" planimetria="0" type="foto"> <id>0</id> <file_path>https://##.jpg </file_path> </allegato> <allegato id="1" planimetria="1" type="planimetria"> <id>1</id> <file_path>https://##.jpg </file_path> </allegato> </file_allegati> DATA; function set_planimetrie($allegati) { $result = ''; $xml = new SimpleXMLElement($allegati); foreach ($xml->children() as $allegato) { if ((string)$allegato['type'] === 'planimetria' && (string)$allegato['planimetria'] === "1") { if ($result !== '') { $result .= ','; } $result .= $allegato->file_path; } } return $result; } var_dump(set_planimetrie($data));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v9d7U
function name:  (null)
number of ops:  8
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cfile_allegati%3E%0A++%3Callegato+id%3D%220%22+planimetria%3D%220%22+type%3D%22foto%22%3E%0A++++%3Cid%3E0%3C%2Fid%3E%0A++++%3Cfile_path%3Ehttps%3A%2F%2F%23%23.jpg+%3C%2Ffile_path%3E%0A++%3C%2Fallegato%3E%0A++%3Callegato+id%3D%221%22+planimetria%3D%221%22+type%3D%22planimetria%22%3E%0A++++%3Cid%3E1%3C%2Fid%3E%0A++++%3Cfile_path%3Ehttps%3A%2F%2F%23%23.jpg+%3C%2Ffile_path%3E%0A++%3C%2Fallegato%3E%0A%3C%2Ffile_allegati%3E'
   32     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'set_planimetrie'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function set_planimetrie:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 25
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 25
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 22
Branch analysis from position: 24
Branch analysis from position: 18
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/v9d7U
function name:  set_planimetrie
number of ops:  28
compiled vars:  !0 = $allegati, !1 = $result, !2 = $xml, !3 = $allegato
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1        ASSIGN                                                   !1, ''
   19     2        NEW                                              $5      'SimpleXMLElement'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $5
   21     6        INIT_METHOD_CALL                                         !2, 'children'
          7        DO_FCALL                                      0  $8      
          8      > FE_RESET_R                                       $9      $8, ->25
          9    > > FE_FETCH_R                                               $9, !3, ->25
   22    10    >   FETCH_DIM_R                                      ~10     !3, 'type'
         11        CAST                                          6  ~11     ~10
         12        IS_IDENTICAL                                     ~12     ~11, 'planimetria'
         13      > JMPZ_EX                                          ~12     ~12, ->18
         14    >   FETCH_DIM_R                                      ~13     !3, 'planimetria'
         15        CAST                                          6  ~14     ~13
         16        IS_IDENTICAL                                     ~15     ~14, '1'
         17        BOOL                                             ~12     ~15
         18    > > JMPZ                                                     ~12, ->24
   23    19    >   IS_NOT_IDENTICAL                                         !1, ''
         20      > JMPZ                                                     ~16, ->22
   24    21    >   ASSIGN_OP                                     8          !1, '%2C'
   26    22    >   FETCH_OBJ_R                                      ~18     !3, 'file_path'
         23        ASSIGN_OP                                     8          !1, ~18
   21    24    > > JMP                                                      ->9
         25    >   FE_FREE                                                  $9
   29    26      > RETURN                                                   !1
   30    27*     > RETURN                                                   null

End of function set_planimetrie

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.47 ms | 1005 KiB | 15 Q