3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str=<<<XML <scales> <scale id="1" gender="*" age="*"> <d scid="hi" raw="10" t="76" /> <d scid="pn" raw="12" t="80" /> </scale> <scale id="2" gender="m" age="*"> <d scid="hi" raw="8" t="79" /> <d scid="pn" raw="2" t="50" /> </scale> <scale id="3" gender="*" age="19-39"> <d scid="hi" raw="0" t="48" /> <d scid="pn" raw="10" t="49" /> </scale> </scales> XML; $xml=simplexml_load_string($str); $result=$xml->xpath('//scale[@gender="*" or @gender="m"]/d[@age="*" or @age="39-59"]/d'); foreach($result as $node) { echo $node->attributes()->id."\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/ogXo0
function name:  (null)
number of ops:  19
compiled vars:  !0 = $str, !1 = $xml, !2 = $result, !3 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cscales%3E%0A++++%3Cscale+id%3D%221%22+gender%3D%22%2A%22+age%3D%22%2A%22%3E%0A++++++++%3Cd+scid%3D%22hi%22+raw%3D%2210%22+t%3D%2276%22+%2F%3E%0A++++++++%3Cd+scid%3D%22pn%22+raw%3D%2212%22+t%3D%2280%22+%2F%3E%0A++++%3C%2Fscale%3E%0A++++%3Cscale+id%3D%222%22+gender%3D%22m%22+age%3D%22%2A%22%3E%0A++++++++%3Cd+scid%3D%22hi%22+raw%3D%228%22+t%3D%2279%22+%2F%3E%0A++++++++%3Cd+scid%3D%22pn%22+raw%3D%222%22+t%3D%2250%22+%2F%3E%0A++++%3C%2Fscale%3E%0A++++%3Cscale+id%3D%223%22+gender%3D%22%2A%22+age%3D%2219-39%22%3E%0A++++++++%3Cd+scid%3D%22hi%22+raw%3D%220%22+t%3D%2248%22+%2F%3E%0A++++++++%3Cd+scid%3D%22pn%22+raw%3D%2210%22+t%3D%2249%22+%2F%3E%0A++++%3C%2Fscale%3E%0A%3C%2Fscales%3E'
   18     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   19     5        INIT_METHOD_CALL                                         !1, 'xpath'
          6        SEND_VAL_EX                                              '%2F%2Fscale%5B%40gender%3D%22%2A%22+or+%40gender%3D%22m%22%5D%2Fd%5B%40age%3D%22%2A%22+or+%40age%3D%2239-59%22%5D%2Fd'
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !2, $7
   20     9      > FE_RESET_R                                       $9      !2, ->17
         10    > > FE_FETCH_R                                               $9, !3, ->17
   22    11    >   INIT_METHOD_CALL                                         !3, 'attributes'
         12        DO_FCALL                                      0  $10     
         13        FETCH_OBJ_R                                      ~11     $10, 'id'
         14        CONCAT                                           ~12     ~11, '%0A'
         15        ECHO                                                     ~12
   20    16      > JMP                                                      ->10
         17    >   FE_FREE                                                  $9
   23    18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.24 ms | 1396 KiB | 15 Q