3v4l.org

run code in 300+ PHP versions simultaneously
<?php function purgeAttributes( $object ) { foreach ( $object as $key => $value ) { if ( gettype( $value ) == 'object' ) { $object->$key = purgeAttributes( $value ); } if ( $key == '@attributes' ) { unset( $object->$key ); } } return $object; } $x = SimpleXML_load_string('<foo bar="baz" />'); $x = purgeAttributes( $x ); var_dump( $x );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N3NN7
function name:  (null)
number of ops:  12
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'simplexml_load_string'
          1        SEND_VAL                                                 '%3Cfoo+bar%3D%22baz%22+%2F%3E'
          2        DO_ICALL                                         $1      
          3        ASSIGN                                                   !0, $1
   19     4        INIT_FCALL                                               'purgeattributes'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $3      
          7        ASSIGN                                                   !0, $3
   21     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function purgeattributes:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 16
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
Branch analysis from position: 12
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/N3NN7
function name:  purgeAttributes
number of ops:  19
compiled vars:  !0 = $object, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1      > FE_RESET_R                                       $3      !0, ->16
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->16
          3    >   ASSIGN                                                   !2, ~4
    5     4        GET_TYPE                                         ~6      !1
          5        IS_EQUAL                                                 ~6, 'object'
          6      > JMPZ                                                     ~7, ->12
    6     7    >   INIT_FCALL_BY_NAME                                       'purgeAttributes'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $9      
         10        ASSIGN_OBJ                                               !0, !2
         11        OP_DATA                                                  $9
    9    12    >   IS_EQUAL                                                 !2, '%40attributes'
         13      > JMPZ                                                     ~10, ->15
   10    14    >   UNSET_OBJ                                                !0, !2
    4    15    > > JMP                                                      ->2
         16    >   FE_FREE                                                  $3
   14    17      > RETURN                                                   !0
   15    18*     > RETURN                                                   null

End of function purgeattributes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.74 ms | 1399 KiB | 18 Q