3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = "<table> <tr> <td>AAA</td> <td>30,40 €</td> <td>41,10 €</td> </tr> <tr> <td>BBB</td> <td>30,40 €</td> <td>41,10 €</td> </tr> <tr> <td>CCC</td> <td>30,40 €</td> <td>41,10 €</td> </tr> </table>"; $doc = new DOMDocument(); $doc->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($doc); foreach ($xpath->query('//td[1]') as $td) { $td->setAttribute('class', 'first'); } echo $doc->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/4ctgD
function name:  (null)
number of ops:  32
compiled vars:  !0 = $content, !1 = $doc, !2 = $xpath, !3 = $td
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Ctable%3E%0A%3Ctr%3E%0A++%3Ctd%3EAAA%3C%2Ftd%3E%0A++%3Ctd%3E30%2C40+%E2%82%AC%3C%2Ftd%3E%0A++%3Ctd%3E41%2C10+%E2%82%AC%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A++%3Ctd%3EBBB%3C%2Ftd%3E%0A++%3Ctd%3E30%2C40+%E2%82%AC%3C%2Ftd%3E%0A++%3Ctd%3E41%2C10+%E2%82%AC%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A++%3Ctd%3ECCC%3C%2Ftd%3E%0A++%3Ctd%3E30%2C40+%E2%82%AC%3C%2Ftd%3E%0A++%3Ctd%3E41%2C10+%E2%82%AC%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3C%2Ftable%3E'
   19     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
   20     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        INIT_FCALL                                               'mb_convert_encoding'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'HTML-ENTITIES'
          8        SEND_VAL                                                 'UTF-8'
          9        DO_ICALL                                         $8      
         10        SEND_VAR_NO_REF_EX                                       $8
         11        SEND_VAL_EX                                              8196
         12        DO_FCALL                                      0          
   21    13        NEW                                              $10     'DOMXPath'
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $10
   22    17        INIT_METHOD_CALL                                         !2, 'query'
         18        SEND_VAL_EX                                              '%2F%2Ftd%5B1%5D'
         19        DO_FCALL                                      0  $13     
         20      > FE_RESET_R                                       $14     $13, ->27
         21    > > FE_FETCH_R                                               $14, !3, ->27
   23    22    >   INIT_METHOD_CALL                                         !3, 'setAttribute'
         23        SEND_VAL_EX                                              'class'
         24        SEND_VAL_EX                                              'first'
         25        DO_FCALL                                      0          
   22    26      > JMP                                                      ->21
         27    >   FE_FREE                                                  $14
   25    28        INIT_METHOD_CALL                                         !1, 'saveHTML'
         29        DO_FCALL                                      0  $16     
         30        ECHO                                                     $16
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.19 ms | 1011 KiB | 14 Q