3v4l.org

run code in 500+ PHP versions simultaneously
<?php $doc = new \DomDocument(); $doc->loadHtml('<div class="foo"></div>'); $div = $doc->getElementsByTagName("div")->item(0); $orgAttr = $div->getAttributeNode("class"); $newAttr = $div->setAttribute("class", "blubb"); if ($orgAttr === $newAttr) { echo "Same attribute\n"; } else { echo "New Attribute\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8YrUO
function name:  (null)
number of ops:  28
compiled vars:  !0 = $doc, !1 = $div, !2 = $orgAttr, !3 = $newAttr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   NEW                                                  $4      'DomDocument'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $4
    4     3        INIT_METHOD_CALL                                             !0, 'loadHtml'
          4        SEND_VAL_EX                                                  '%3Cdiv+class%3D%22foo%22%3E%3C%2Fdiv%3E'
          5        DO_FCALL                                          0          
    5     6        INIT_METHOD_CALL                                             !0, 'getElementsByTagName'
          7        SEND_VAL_EX                                                  'div'
          8        DO_FCALL                                          0  $8      
          9        INIT_METHOD_CALL                                             $8, 'item'
         10        SEND_VAL_EX                                                  0
         11        DO_FCALL                                          0  $9      
         12        ASSIGN                                                       !1, $9
    7    13        INIT_METHOD_CALL                                             !1, 'getAttributeNode'
         14        SEND_VAL_EX                                                  'class'
         15        DO_FCALL                                          0  $11     
         16        ASSIGN                                                       !2, $11
    8    17        INIT_METHOD_CALL                                             !1, 'setAttribute'
         18        SEND_VAL_EX                                                  'class'
         19        SEND_VAL_EX                                                  'blubb'
         20        DO_FCALL                                          0  $13     
         21        ASSIGN                                                       !3, $13
   10    22        IS_IDENTICAL                                                 !2, !3
         23      > JMPZ                                                         ~15, ->26
   11    24    >   ECHO                                                         'Same+attribute%0A'
   10    25      > JMP                                                          ->27
   13    26    >   ECHO                                                         'New+Attribute%0A'
   14    27    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.43 ms | 1990 KiB | 13 Q