3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml=simplexml_load_string(<<<XML <products> <product id="001"> <name>Shirt 1 - Women's</name> <price>12.00</price> <color>blue</color> </product> <product id="002"> <name>Shirt 1 - Men's</name> <price>12.00</price> <color>red</color> </product> <product id="023"> <name>Shirt 12 - Women's</name> <price>15.00</price> <color>purple</color> </product> <product id="024"> <name>Shirt 12 - Men's</name> <price>15.00</price> <color>yellow</color> </product> </products> XML ); foreach($xml->xpath('//product[starts-with(name/text(),"")]') as $product) { echo $product->name; echo "\n"; echo $product->color; echo "\n\n"; }
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
Jump found. Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
Jump found. Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 16
Jump found. Position 1 = -2
Branch analysis from position: 16
filename:       /in/ZPHaj
function name:  (null)
number of ops:  18
compiled vars:  !0 = $xml, !1 = $product
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   INIT_FCALL                                               'simplexml_load_string'
  27     1        SEND_VAL                                                 '%3Cproducts%3E%0A++%3Cproduct+id%3D%22001%22%3E%0A++++%3Cname%3EShirt+1+-+Women%27s%3C%2Fname%3E%0A++++%3Cprice%3E12.00%3C%2Fprice%3E%0A++++%3Ccolor%3Eblue%3C%2Fcolor%3E%0A++%3C%2Fproduct%3E%0A%0A++%3Cproduct+id%3D%22002%22%3E%0A++++%3Cname%3EShirt+1+-+Men%27s%3C%2Fname%3E%0A++++%3Cprice%3E12.00%3C%2Fprice%3E%0A++++%3Ccolor%3Ered%3C%2Fcolor%3E%0A++%3C%2Fproduct%3E%0A++%3Cproduct+id%3D%22023%22%3E%0A++++%3Cname%3EShirt+12+-+Women%27s%3C%2Fname%3E%0A++++%3Cprice%3E15.00%3C%2Fprice%3E%0A++++%3Ccolor%3Epurple%3C%2Fcolor%3E%0A++%3C%2Fproduct%3E%0A%0A++%3Cproduct+id%3D%22024%22%3E%0A++++%3Cname%3EShirt+12+-+Men%27s%3C%2Fname%3E%0A++++%3Cprice%3E15.00%3C%2Fprice%3E%0A++++%3Ccolor%3Eyellow%3C%2Fcolor%3E%0A++%3C%2Fproduct%3E%0A%0A%3C%2Fproducts%3E'
         2        DO_ICALL                                         $2      
         3        ASSIGN                                                   !0, $2
  30     4        INIT_METHOD_CALL                                         !0, 'xpath'
         5        SEND_VAL_EX                                              '%2F%2Fproduct%5Bstarts-with%28name%2Ftext%28%29%2C%22%22%29%5D'
         6        DO_FCALL                                      0  $4      
         7      > FE_RESET_R                                       $5      $4, ->16
         8    > > FE_FETCH_R                                               $5, !1, ->16
  32     9    >   FETCH_OBJ_R                                      $6      !1, 'name'
        10        ECHO                                                     $6
  33    11        ECHO                                                     '%0A'
  34    12        FETCH_OBJ_R                                      $7      !1, 'color'
        13        ECHO                                                     $7
  35    14        ECHO                                                     '%0A%0A'
        15      > JMP                                                      ->8
        16    >   FE_FREE                                                  $5
        17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.1.0