3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = 'HTML String <h3>whatever</h3>'; $dom = new DOMDocument; $dom->loadHTML($html, LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($dom); foreach ($xpath->query('//h3') as $h3) { $h3->firstChild->nodeValue = ucfirst($h3->firstChild->nodeValue); } echo $dom->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 26
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/AhYuB
function name:  (null)
number of ops:  31
compiled vars:  !0 = $html, !1 = $dom, !2 = $xpath, !3 = $h3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'HTML+String+%3Ch3%3Ewhatever%3C%2Fh3%3E'
    4     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
    5     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        SEND_VAL_EX                                              4
          7        DO_FCALL                                      0          
    6     8        NEW                                              $9      'DOMXPath'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $9
    7    12        INIT_METHOD_CALL                                         !2, 'query'
         13        SEND_VAL_EX                                              '%2F%2Fh3'
         14        DO_FCALL                                      0  $12     
         15      > FE_RESET_R                                       $13     $12, ->26
         16    > > FE_FETCH_R                                               $13, !3, ->26
    8    17    >   INIT_FCALL                                               'ucfirst'
         18        FETCH_OBJ_R                                      ~16     !3, 'firstChild'
         19        FETCH_OBJ_R                                      ~17     ~16, 'nodeValue'
         20        SEND_VAL                                                 ~17
         21        DO_ICALL                                         $18     
         22        FETCH_OBJ_W                                      $14     !3, 'firstChild'
         23        ASSIGN_OBJ                                               $14, 'nodeValue'
         24        OP_DATA                                                  $18
    7    25      > JMP                                                      ->16
         26    >   FE_FREE                                                  $13
   10    27        INIT_METHOD_CALL                                         !1, 'saveHTML'
         28        DO_FCALL                                      0  $19     
         29        ECHO                                                     $19
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.02 ms | 1396 KiB | 15 Q