3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @link http://stackoverflow.com/questions/10543397/php-domnode-nodevalue-doesnt-work-properly */ $html = <<<HTML <option value="A26JUYT14N57PY">Aleksander&#39;s Kindle Cloud Reader</option> <option value="A13400OMTGFDRH">Aleksander&#39;s Kindle for PC</option> <optgroup label="----OR----" style="color:#999;font-style:normal;font-weight:normal"> </optgroup> <option value="add-new">Register a new Kindle</option> HTML; $dom = new DOMDocument(); $dom->loadHTML($html); $options = $dom->getElementsByTagName('option'); foreach($options as $option) { $attr = $option->getAttribute('value'); $value = $option->nodeValue; printf("%s : %s\n", $attr, $value); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 25
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 25
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/N6D7W
function name:  (null)
number of ops:  27
compiled vars:  !0 = $html, !1 = $dom, !2 = $options, !3 = $option, !4 = $attr, !5 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, '%3Coption+value%3D%22A26JUYT14N57PY%22%3EAleksander%26%2339%3Bs+Kindle+Cloud+Reader%3C%2Foption%3E%0A%3Coption+value%3D%22A13400OMTGFDRH%22%3EAleksander%26%2339%3Bs+Kindle+for+PC%3C%2Foption%3E%0A%3Coptgroup+label%3D%22----OR----%22+style%3D%22color%3A%23999%3Bfont-style%3Anormal%3Bfont-weight%3Anormal%22%3E+%3C%2Foptgroup%3E%0A%3Coption+value%3D%22add-new%22%3ERegister+a+new+Kindle%3C%2Foption%3E'
   13     1        NEW                                              $7      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
   14     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   15     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'option'
          9        DO_FCALL                                      0  $11     
         10        ASSIGN                                                   !2, $11
   16    11      > FE_RESET_R                                       $13     !2, ->25
         12    > > FE_FETCH_R                                               $13, !3, ->25
   18    13    >   INIT_METHOD_CALL                                         !3, 'getAttribute'
         14        SEND_VAL_EX                                              'value'
         15        DO_FCALL                                      0  $14     
         16        ASSIGN                                                   !4, $14
   19    17        FETCH_OBJ_R                                      ~16     !3, 'nodeValue'
         18        ASSIGN                                                   !5, ~16
   20    19        INIT_FCALL                                               'printf'
         20        SEND_VAL                                                 '%25s+%3A+%25s%0A'
         21        SEND_VAR                                                 !4
         22        SEND_VAR                                                 !5
         23        DO_ICALL                                                 
   16    24      > JMP                                                      ->12
         25    >   FE_FREE                                                  $13
   21    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.88 ms | 1396 KiB | 15 Q