3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml_reader = \XMLReader::fromString(' <sparql xmlns="http://www.w3.org/2005/sparql-results#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/sw/DataAccess/rf1/result2.xsd"> <head> <variable name="s"/> <variable name="p"/> </head> <results> <result> <binding name="s"><uri>https://assetmodel.moxio.com/concept/bestaat_uit</uri></binding> <binding name="p"><uri>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</uri></binding> </result> <result> <binding name="s"><uri>https://assetmodel.moxio.com/concept/bestaat_uit</uri></binding> </result> </results> </sparql>'); $success = $xml_reader->next("sparql"); assert($success, "The XML-reply should start with a sparql element"); $success = $xml_reader->read(); assert($success, "It should be possible to move into the sparql element"); $success = $xml_reader->next("head"); assert($success, "The sparql element should contain a head element"); $success = $xml_reader->read(); assert($success, "It should be possible to move into the sparql element"); $success = $xml_reader->next("results"); assert($success, "The sparql element should contain a head element"); while ($xml_reader->read() === true) { if ($xml_reader->next("result") === true) { $result_as_dom_node = $xml_reader->expand(); assert($result_as_dom_node !== false, "The result-element could not be expanded to a dom node"); /** @var \DOMNode $binding_node */ foreach ($result_as_dom_node->childNodes as $binding_node) { if ($binding_node->nodeType === XML_ELEMENT_NODE) { $variable_name = $binding_node->getAttribute("name"); /** @var \DOMNode $binding_value_node */ foreach ($binding_node->childNodes as $binding_value_node) { } } } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 79
Branch analysis from position: 79
2 jumps found. (Code = 44) Position 1 = 83, Position 2 = 48
Branch analysis from position: 83
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 79
Branch analysis from position: 53
2 jumps found. (Code = 77) Position 1 = 64, Position 2 = 78
Branch analysis from position: 64
2 jumps found. (Code = 78) Position 1 = 65, Position 2 = 78
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 77
Branch analysis from position: 68
2 jumps found. (Code = 77) Position 1 = 74, Position 2 = 76
Branch analysis from position: 74
2 jumps found. (Code = 78) Position 1 = 75, Position 2 = 76
Branch analysis from position: 75
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
Branch analysis from position: 76
Branch analysis from position: 77
Branch analysis from position: 78
2 jumps found. (Code = 44) Position 1 = 83, Position 2 = 48
Branch analysis from position: 83
Branch analysis from position: 48
Branch analysis from position: 78
Branch analysis from position: 79
filename:       /in/SaDYr
function name:  (null)
number of ops:  84
compiled vars:  !0 = $xml_reader, !1 = $success, !2 = $result_as_dom_node, !3 = $binding_node, !4 = $variable_name, !5 = $binding_value_node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_STATIC_METHOD_CALL                                  'XMLReader', 'fromString'
          1        SEND_VAL_EX                                              '%0A%3Csparql+xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2005%2Fsparql-results%23%22+xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22+xsi%3AschemaLocation%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2Fsw%2FDataAccess%2Frf1%2Fresult2.xsd%22%3E%0A+%3Chead%3E%0A++%3Cvariable+name%3D%22s%22%2F%3E%0A++%3Cvariable+name%3D%22p%22%2F%3E%0A+%3C%2Fhead%3E%0A+%3Cresults%3E%0A++%3Cresult%3E%0A+++%3Cbinding+name%3D%22s%22%3E%3Curi%3Ehttps%3A%2F%2Fassetmodel.moxio.com%2Fconcept%2Fbestaat_uit%3C%2Furi%3E%3C%2Fbinding%3E%0A+++%3Cbinding+name%3D%22p%22%3E%3Curi%3Ehttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3C%2Furi%3E%3C%2Fbinding%3E%0A++%3C%2Fresult%3E%0A++%3Cresult%3E%0A+++%3Cbinding+name%3D%22s%22%3E%3Curi%3Ehttps%3A%2F%2Fassetmodel.moxio.com%2Fconcept%2Fbestaat_uit%3C%2Furi%3E%3C%2Fbinding%3E%0A++%3C%2Fresult%3E%0A+%3C%2Fresults%3E%0A%3C%2Fsparql%3E'
          2        DO_FCALL                                      0  $6      
          3        ASSIGN                                                   !0, $6
   20     4        INIT_METHOD_CALL                                         !0, 'next'
          5        SEND_VAL_EX                                              'sparql'
          6        DO_FCALL                                      0  $8      
          7        ASSIGN                                                   !1, $8
   21     8        ASSERT_CHECK                                             
          9        INIT_FCALL                                               'assert'
         10        SEND_VAR                                                 !1
         11        SEND_VAL                                                 'The+XML-reply+should+start+with+a+sparql+element'
         12        DO_ICALL                                                 
   22    13        INIT_METHOD_CALL                                         !0, 'read'
         14        DO_FCALL                                      0  $11     
         15        ASSIGN                                                   !1, $11
   23    16        ASSERT_CHECK                                             
         17        INIT_FCALL                                               'assert'
         18        SEND_VAR                                                 !1
         19        SEND_VAL                                                 'It+should+be+possible+to+move+into+the+sparql+element'
         20        DO_ICALL                                                 
   24    21        INIT_METHOD_CALL                                         !0, 'next'
         22        SEND_VAL_EX                                              'head'
         23        DO_FCALL                                      0  $14     
         24        ASSIGN                                                   !1, $14
   25    25        ASSERT_CHECK                                             
         26        INIT_FCALL                                               'assert'
         27        SEND_VAR                                                 !1
         28        SEND_VAL                                                 'The+sparql+element+should+contain+a+head+element'
         29        DO_ICALL                                                 
   27    30        INIT_METHOD_CALL                                         !0, 'read'
         31        DO_FCALL                                      0  $17     
         32        ASSIGN                                                   !1, $17
   28    33        ASSERT_CHECK                                             
         34        INIT_FCALL                                               'assert'
         35        SEND_VAR                                                 !1
         36        SEND_VAL                                                 'It+should+be+possible+to+move+into+the+sparql+element'
         37        DO_ICALL                                                 
   29    38        INIT_METHOD_CALL                                         !0, 'next'
         39        SEND_VAL_EX                                              'results'
         40        DO_FCALL                                      0  $20     
         41        ASSIGN                                                   !1, $20
   30    42        ASSERT_CHECK                                             
         43        INIT_FCALL                                               'assert'
         44        SEND_VAR                                                 !1
         45        SEND_VAL                                                 'The+sparql+element+should+contain+a+head+element'
         46        DO_ICALL                                                 
   32    47      > JMP                                                      ->79
   33    48    >   INIT_METHOD_CALL                                         !0, 'next'
         49        SEND_VAL_EX                                              'result'
         50        DO_FCALL                                      0  $23     
         51        TYPE_CHECK                                    8          $23
         52      > JMPZ                                                     ~24, ->79
   35    53    >   INIT_METHOD_CALL                                         !0, 'expand'
         54        DO_FCALL                                      0  $25     
         55        ASSIGN                                                   !2, $25
   36    56        ASSERT_CHECK                                             
         57        INIT_FCALL                                               'assert'
         58        TYPE_CHECK                                  1018  ~27     !2
         59        SEND_VAL                                                 ~27
         60        SEND_VAL                                                 'The+result-element+could+not+be+expanded+to+a+dom+node'
         61        DO_ICALL                                                 
   39    62        FETCH_OBJ_R                                      ~29     !2, 'childNodes'
         63      > FE_RESET_R                                       $30     ~29, ->78
         64    > > FE_FETCH_R                                               $30, !3, ->78
   40    65    >   FETCH_OBJ_R                                      ~31     !3, 'nodeType'
         66        IS_IDENTICAL                                             ~31, 1
         67      > JMPZ                                                     ~32, ->77
   41    68    >   INIT_METHOD_CALL                                         !3, 'getAttribute'
         69        SEND_VAL_EX                                              'name'
         70        DO_FCALL                                      0  $33     
         71        ASSIGN                                                   !4, $33
   43    72        FETCH_OBJ_R                                      ~35     !3, 'childNodes'
         73      > FE_RESET_R                                       $36     ~35, ->76
         74    > > FE_FETCH_R                                               $36, !5, ->76
         75    > > JMP                                                      ->74
         76    >   FE_FREE                                                  $36
   39    77    > > JMP                                                      ->64
         78    >   FE_FREE                                                  $30
   32    79    >   INIT_METHOD_CALL                                         !0, 'read'
         80        DO_FCALL                                      0  $37     
         81        TYPE_CHECK                                    8          $37
         82      > JMPNZ                                                    ~38, ->48
   48    83    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.61 ms | 1009 KiB | 14 Q