3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<EOD <book xmlns:chap="http://example.org/chapter-title"> <title>My Book</title> <chapter id="1"> <chap:title>Chapter 1</chap:title> <para>Donec velit. Nullam eget tellus vitae tortor gravida scelerisque. In orci lorem, cursus imperdiet, ultricies non, hendrerit et, orci. Nulla facilisi. Nullam velit nisl, laoreet id, condimentum ut, ultricies id, mauris.</para> </chapter> <chapter id="2"> <chap:title>Chapter 2</chap:title> <para>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin gravida. Phasellus tincidunt massa vel urna. Proin adipiscing quam vitae odio. Sed dictum. Ut tincidunt lorem ac lorem. Duis eros tellus, pharetra id, faucibus eu, dapibus dictum, odio.</para> </chapter> </book> EOD; $sxe = new SimpleXMLElement($xml); $sxe->registerXPathNamespace('c', 'http://example.org/chapter-title'); $result = $sxe->xpath('//c:title'); foreach ($result as $title) { echo $title . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/ldq2I
function name:  (null)
number of ops:  20
compiled vars:  !0 = $xml, !1 = $sxe, !2 = $result, !3 = $title
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cbook+xmlns%3Achap%3D%22http%3A%2F%2Fexample.org%2Fchapter-title%22%3E%0A++++%3Ctitle%3EMy+Book%3C%2Ftitle%3E%0A++++%3Cchapter+id%3D%221%22%3E%0A++++++++%3Cchap%3Atitle%3EChapter+1%3C%2Fchap%3Atitle%3E%0A++++++++%3Cpara%3EDonec+velit.+Nullam+eget+tellus+vitae+tortor+gravida+scelerisque.+%0A++++++++++++In+orci+lorem%2C+cursus+imperdiet%2C+ultricies+non%2C+hendrerit+et%2C+orci.+%0A++++++++++++Nulla+facilisi.+Nullam+velit+nisl%2C+laoreet+id%2C+condimentum+ut%2C+%0A++++++++++++ultricies+id%2C+mauris.%3C%2Fpara%3E%0A++++%3C%2Fchapter%3E%0A++++%3Cchapter+id%3D%222%22%3E%0A++++++++%3Cchap%3Atitle%3EChapter+2%3C%2Fchap%3Atitle%3E%0A++++++++%3Cpara%3ELorem+ipsum+dolor+sit+amet%2C+consectetuer+adipiscing+elit.+Proin+%0A++++++++++++gravida.+Phasellus+tincidunt+massa+vel+urna.+Proin+adipiscing+quam+%0A++++++++++++vitae+odio.+Sed+dictum.+Ut+tincidunt+lorem+ac+lorem.+Duis+eros+%0A++++++++++++tellus%2C+pharetra+id%2C+faucibus+eu%2C+dapibus+dictum%2C+odio.%3C%2Fpara%3E%0A++++%3C%2Fchapter%3E%0A%3C%2Fbook%3E'
   22     1        NEW                                              $5      'SimpleXMLElement'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   24     5        INIT_METHOD_CALL                                         !1, 'registerXPathNamespace'
          6        SEND_VAL_EX                                              'c'
          7        SEND_VAL_EX                                              'http%3A%2F%2Fexample.org%2Fchapter-title'
          8        DO_FCALL                                      0          
   25     9        INIT_METHOD_CALL                                         !1, 'xpath'
         10        SEND_VAL_EX                                              '%2F%2Fc%3Atitle'
         11        DO_FCALL                                      0  $9      
         12        ASSIGN                                                   !2, $9
   27    13      > FE_RESET_R                                       $11     !2, ->18
         14    > > FE_FETCH_R                                               $11, !3, ->18
   28    15    >   CONCAT                                           ~12     !3, '%0A'
         16        ECHO                                                     ~12
   27    17      > JMP                                                      ->14
         18    >   FE_FREE                                                  $11
   29    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.18 ms | 1395 KiB | 13 Q