3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = '<?xml version="1.0" encoding="ISO-8859-1" ?> <Servicos> <cServico> <Codigo>40010</Codigo> </cServico> </Servicos>'; $b = '<?xml version="1.0" encoding="ISO-8859-1" ?> <Servicos> <cServico> <Codigo>40010</Codigo> </cServico> <cServico> <Codigo>40011</Codigo> </cServico> </Servicos>'; function getCodes(SimpleXMLElement $xml) { $codes = array(); foreach ($xml->cServico as $item) { $codes[] = (string)$item->Codigo; } return $codes; } var_dump(getCodes(new SimpleXMLElement($a))); var_dump(getCodes(new SimpleXMLElement($b)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ff5X0
function name:  (null)
number of ops:  21
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22ISO-8859-1%22+%3F%3E%0A%3CServicos%3E%0A+%3CcServico%3E%0A++%3CCodigo%3E40010%3C%2FCodigo%3E%0A+%3C%2FcServico%3E%0A%3C%2FServicos%3E'
   10     1        ASSIGN                                                   !1, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22ISO-8859-1%22+%3F%3E%0A%3CServicos%3E%0A+%3CcServico%3E%0A++%3CCodigo%3E40010%3C%2FCodigo%3E%0A+%3C%2FcServico%3E%0A+%3CcServico%3E%0A++%3CCodigo%3E40011%3C%2FCodigo%3E%0A+%3C%2FcServico%3E%0A%3C%2FServicos%3E'
   28     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'getcodes'
          4        NEW                                              $4      'SimpleXMLElement'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        SEND_VAR                                                 $4
          8        DO_FCALL                                      0  $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                                 
   29    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'getcodes'
         13        NEW                                              $8      'SimpleXMLElement'
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0          
         16        SEND_VAR                                                 $8
         17        DO_FCALL                                      0  $10     
         18        SEND_VAR                                                 $10
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function getcodes:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/ff5X0
function name:  getCodes
number of ops:  13
compiled vars:  !0 = $xml, !1 = $codes, !2 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        ASSIGN                                                   !1, <array>
   22     2        FETCH_OBJ_R                                      ~4      !0, 'cServico'
          3      > FE_RESET_R                                       $5      ~4, ->10
          4    > > FE_FETCH_R                                               $5, !2, ->10
   23     5    >   FETCH_OBJ_R                                      ~7      !2, 'Codigo'
          6        CAST                                          6  ~8      ~7
          7        ASSIGN_DIM                                               !1
          8        OP_DATA                                                  ~8
   22     9      > JMP                                                      ->4
         10    >   FE_FREE                                                  $5
   25    11      > RETURN                                                   !1
   26    12*     > RETURN                                                   null

End of function getcodes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.03 ms | 1017 KiB | 16 Q