3v4l.org

run code in 300+ PHP versions simultaneously
<?php $source = <<<SOURCE <?xml version="1.0" encoding="utf-8" ?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:apcm="http://ap.org/schemas/03/2005/apcm" xmlns:apnm="http://ap.org/schemas/03/2005/apnm" xmlns:georss="http://www.georss.org/georss" xmlns:o="http://w3.org/ns/odrl/2/"> <entry xmlns="http://www.w3.org/2005/Atom"> <apcm:ContentMetadata xmlns:apcm="http://ap.org/schemas/03/2005/apcm"> <apcm:Property Name="EntitlementMatch" Id="urn:publicid:ap.org:product:41664" Value="AP Top News"/> <apcm:Property Name="EntitlementMatch" Id="urn:publicid:ap.org:product:42430" Value="AP Top News - International - Stories"/> <apcm:Property Name="EntitlementMatch" Id="urn:publicid:ap.org:package:100518" Value="AP Top News Package"/> </apcm:ContentMetadata> </entry> </feed> SOURCE; $feed_entry = simplexml_load_string($source); $feed_entry->registerXPathNamespace('a', 'http://www.w3.org/2005/Atom'); $elements = $feed_entry->xpath('//a:entry/apcm:ContentMetadata/apcm:Property'); foreach ($elements as $element) { $id = $element->attributes()->Id->__toString(); $value = $element->attributes()->Value->__toString(); echo "The Id is: $id and the Value is: $value" . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 34
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 34
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/bRCJH
function name:  (null)
number of ops:  36
compiled vars:  !0 = $source, !1 = $feed_entry, !2 = $elements, !3 = $element, !4 = $id, !5 = $value
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%0A%3Cfeed+xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2005%2FAtom%22+xmlns%3Aapcm%3D%22http%3A%2F%2Fap.org%2Fschemas%2F03%2F2005%2Fapcm%22%0A++++++xmlns%3Aapnm%3D%22http%3A%2F%2Fap.org%2Fschemas%2F03%2F2005%2Fapnm%22+xmlns%3Ageorss%3D%22http%3A%2F%2Fwww.georss.org%2Fgeorss%22%0A++++++xmlns%3Ao%3D%22http%3A%2F%2Fw3.org%2Fns%2Fodrl%2F2%2F%22%3E%0A++++%3Centry+xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2005%2FAtom%22%3E%0A++++++++%3Capcm%3AContentMetadata+xmlns%3Aapcm%3D%22http%3A%2F%2Fap.org%2Fschemas%2F03%2F2005%2Fapcm%22%3E%0A++++++++++++%3Capcm%3AProperty+Name%3D%22EntitlementMatch%22+Id%3D%22urn%3Apublicid%3Aap.org%3Aproduct%3A41664%22+Value%3D%22AP+Top+News%22%2F%3E%0A++++++++++++%3Capcm%3AProperty+Name%3D%22EntitlementMatch%22+Id%3D%22urn%3Apublicid%3Aap.org%3Aproduct%3A42430%22+Value%3D%22AP+Top+News+-+International+-+Stories%22%2F%3E%0A++++++++++++%3Capcm%3AProperty+Name%3D%22EntitlementMatch%22+Id%3D%22urn%3Apublicid%3Aap.org%3Apackage%3A100518%22+Value%3D%22AP+Top+News+Package%22%2F%3E%0A++++++++%3C%2Fapcm%3AContentMetadata%3E%0A++++%3C%2Fentry%3E%0A%3C%2Ffeed%3E'
   18     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !1, $7
   19     5        INIT_METHOD_CALL                                         !1, 'registerXPathNamespace'
          6        SEND_VAL_EX                                              'a'
          7        SEND_VAL_EX                                              'http%3A%2F%2Fwww.w3.org%2F2005%2FAtom'
          8        DO_FCALL                                      0          
   20     9        INIT_METHOD_CALL                                         !1, 'xpath'
         10        SEND_VAL_EX                                              '%2F%2Fa%3Aentry%2Fapcm%3AContentMetadata%2Fapcm%3AProperty'
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !2, $10
   22    13      > FE_RESET_R                                       $12     !2, ->34
         14    > > FE_FETCH_R                                               $12, !3, ->34
   23    15    >   INIT_METHOD_CALL                                         !3, 'attributes'
         16        DO_FCALL                                      0  $13     
         17        FETCH_OBJ_R                                      ~14     $13, 'Id'
         18        INIT_METHOD_CALL                                         ~14, '__toString'
         19        DO_FCALL                                      0  $15     
         20        ASSIGN                                                   !4, $15
   24    21        INIT_METHOD_CALL                                         !3, 'attributes'
         22        DO_FCALL                                      0  $17     
         23        FETCH_OBJ_R                                      ~18     $17, 'Value'
         24        INIT_METHOD_CALL                                         ~18, '__toString'
         25        DO_FCALL                                      0  $19     
         26        ASSIGN                                                   !5, $19
   26    27        ROPE_INIT                                     4  ~22     'The+Id+is%3A+'
         28        ROPE_ADD                                      1  ~22     ~22, !4
         29        ROPE_ADD                                      2  ~22     ~22, '+and+the+Value+is%3A+'
         30        ROPE_END                                      3  ~21     ~22, !5
         31        CONCAT                                           ~24     ~21, '%0A'
         32        ECHO                                                     ~24
   22    33      > JMP                                                      ->14
         34    >   FE_FREE                                                  $12
   27    35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.88 ms | 1405 KiB | 15 Q