3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlString = '<'.'?xml version="1.0" encoding="UTF-8"?'.'>' . '<rootEl>' . '<a attrA="valA">xxx</a>' . '<b attrB="valB"/>' . '<c>oink</c>' . '<d/>'. '<e>' . '<f>zzz</f>' . '</e>' . '</rootEl>'; $xml = simplexml_load_string( $xmlString ); foreach ( $xml->children() as $child ) { echo "\$CHILD [" . $child->getName() . "]: " . $child->asXML(); echo "\n"; $insideIf1 = false; if ($child) { $insideIf1 = true; } $insideIf2 = false; if (true == $child) { $insideIf2 = true; } $insideIf3 = false; if ((boolean)$child) { $insideIf3 = true; } echo " - if(\$CHILD) return \"true\"; else return \"false\"; : " . (($insideIf1)?"true":"false")."\n"; echo " - if(true == \$CHILD) return \"true\"; else return \"false\"; : " . (($insideIf2)?"true":"false")."\n"; echo " - if((boolean)\$CHILD) return \"true\"; else return \"false\"; : " . (($insideIf3)?"true":"false")."\n"; echo " - ((\$CHILD)?\"true\":\"false\"): " . (($child)?"true":"false")."\n"; echo " - ((true == \$CHILD)?\"true\":\"false\"): " . ((true == $child)?"true":"false")."\n"; echo " - (((boolean)\$CHILD)?\"true\":\"false\"): " . (((boolean)$child)?"true":"false")."\n"; echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 75
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 75
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 29
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 61
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 69
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 69
Branch analysis from position: 67
Branch analysis from position: 69
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 61
Branch analysis from position: 59
Branch analysis from position: 61
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
Branch analysis from position: 53
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
Branch analysis from position: 46
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
Branch analysis from position: 39
Branch analysis from position: 29
Branch analysis from position: 25
Branch analysis from position: 21
Branch analysis from position: 75
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 75
filename:       /in/ilcnA
function name:  (null)
number of ops:  77
compiled vars:  !0 = $xmlString, !1 = $xml, !2 = $child, !3 = $insideIf1, !4 = $insideIf2, !5 = $insideIf3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%3CrootEl%3E%3Ca+attrA%3D%22valA%22%3Exxx%3C%2Fa%3E%3Cb+attrB%3D%22valB%22%2F%3E%3Cc%3Eoink%3C%2Fc%3E%3Cd%2F%3E%3Ce%3E%3Cf%3Ezzz%3C%2Ff%3E%3C%2Fe%3E%3C%2FrootEl%3E'
   14     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !1, $7
   15     5        INIT_METHOD_CALL                                         !1, 'children'
          6        DO_FCALL                                      0  $9      
          7      > FE_RESET_R                                       $10     $9, ->75
          8    > > FE_FETCH_R                                               $10, !2, ->75
   16     9    >   INIT_METHOD_CALL                                         !2, 'getName'
         10        DO_FCALL                                      0  $11     
         11        CONCAT                                           ~12     '%24CHILD+%5B', $11
         12        CONCAT                                           ~13     ~12, '%5D%3A+'
         13        INIT_METHOD_CALL                                         !2, 'asXML'
         14        DO_FCALL                                      0  $14     
         15        CONCAT                                           ~15     ~13, $14
         16        ECHO                                                     ~15
   17    17        ECHO                                                     '%0A'
   18    18        ASSIGN                                                   !3, <false>
   19    19      > JMPZ                                                     !2, ->21
         20    >   ASSIGN                                                   !3, <true>
   20    21    >   ASSIGN                                                   !4, <false>
   21    22        BOOL                                             ~19     !2
         23      > JMPZ                                                     ~19, ->25
         24    >   ASSIGN                                                   !4, <true>
   22    25    >   ASSIGN                                                   !5, <false>
   23    26        BOOL                                             ~22     !2
         27      > JMPZ                                                     ~22, ->29
         28    >   ASSIGN                                                   !5, <true>
   24    29    > > JMPZ                                                     !3, ->32
         30    >   QM_ASSIGN                                        ~24     'true'
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~24     'false'
         33    >   CONCAT                                           ~25     '++++-+if%28%24CHILD%29+return+%22true%22%3B+else+return+%22false%22%3B+%3A+++++++++++++++++++++', ~24
         34        CONCAT                                           ~26     ~25, '%0A'
         35        ECHO                                                     ~26
   25    36      > JMPZ                                                     !4, ->39
         37    >   QM_ASSIGN                                        ~27     'true'
         38      > JMP                                                      ->40
         39    >   QM_ASSIGN                                        ~27     'false'
         40    >   CONCAT                                           ~28     '++++-+if%28true+%3D%3D+%24CHILD%29+return+%22true%22%3B+else+return+%22false%22%3B+%3A+++++++++++++', ~27
         41        CONCAT                                           ~29     ~28, '%0A'
         42        ECHO                                                     ~29
   26    43      > JMPZ                                                     !5, ->46
         44    >   QM_ASSIGN                                        ~30     'true'
         45      > JMP                                                      ->47
         46    >   QM_ASSIGN                                        ~30     'false'
         47    >   CONCAT                                           ~31     '++++-+if%28%28boolean%29%24CHILD%29+return+%22true%22%3B+else+return+%22false%22%3B+%3A++++++++++++', ~30
         48        CONCAT                                           ~32     ~31, '%0A'
         49        ECHO                                                     ~32
   28    50      > JMPZ                                                     !2, ->53
         51    >   QM_ASSIGN                                        ~33     'true'
         52      > JMP                                                      ->54
         53    >   QM_ASSIGN                                        ~33     'false'
         54    >   CONCAT                                           ~34     '++++-+%28%28%24CHILD%29%3F%22true%22%3A%22false%22%29%3A+++++++++++++++++++++++++++++++++++++++++++', ~33
         55        CONCAT                                           ~35     ~34, '%0A'
         56        ECHO                                                     ~35
   29    57        BOOL                                             ~36     !2
         58      > JMPZ                                                     ~36, ->61
         59    >   QM_ASSIGN                                        ~37     'true'
         60      > JMP                                                      ->62
         61    >   QM_ASSIGN                                        ~37     'false'
         62    >   CONCAT                                           ~38     '++++-+%28%28true+%3D%3D+%24CHILD%29%3F%22true%22%3A%22false%22%29%3A+++++++++++++++++++++++++++++++++++', ~37
         63        CONCAT                                           ~39     ~38, '%0A'
         64        ECHO                                                     ~39
   30    65        BOOL                                             ~40     !2
         66      > JMPZ                                                     ~40, ->69
         67    >   QM_ASSIGN                                        ~41     'true'
         68      > JMP                                                      ->70
         69    >   QM_ASSIGN                                        ~41     'false'
         70    >   CONCAT                                           ~42     '++++-+%28%28%28boolean%29%24CHILD%29%3F%22true%22%3A%22false%22%29%3A++++++++++++++++++++++++++++++++++', ~41
         71        CONCAT                                           ~43     ~42, '%0A'
         72        ECHO                                                     ~43
   32    73        ECHO                                                     '%0A'
   15    74      > JMP                                                      ->8
         75    >   FE_FREE                                                  $10
   33    76      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
236.21 ms | 1409 KiB | 15 Q