3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $string = <<<'EOF' Bar <meta content="text/html; charset=unicode" http-equiv="Content-Type"> Foo EOF; libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML($string); $f = $dom->saveHTML(); echo $f . PHP_EOL . PHP_EOL; $weirdStuff = preg_match('/>([\&\#a-zA-Z0-9\;]+)</', $f, $result); echo $result[1] . PHP_EOL . PHP_EOL; $utf8 = mb_convert_encoding($result[1], 'UTF-8', 'HTML-ENTITIES'); echo $utf8 . PHP_EOL . PHP_EOL; echo iconv('UTF-8', 'unicode', $utf8) . PHP_EOL . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kJ0tV
function name:  (null)
number of ops:  45
compiled vars:  !0 = $string, !1 = $dom, !2 = $f, !3 = $weirdStuff, !4 = $result, !5 = $utf8
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, '+++Bar%0A+++%3Cmeta+content%3D%22text%2Fhtml%3B+charset%3Dunicode%22+http-equiv%3D%22Content-Type%22%3E%0A+++Foo'
   11     1        INIT_FCALL                                               'libxml_use_internal_errors'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                                 
   12     4        NEW                                              $8      'DOMDocument'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $8
   13     7        INIT_METHOD_CALL                                         !1, 'loadHTML'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
   14    10        INIT_METHOD_CALL                                         !1, 'saveHTML'
         11        DO_FCALL                                      0  $12     
         12        ASSIGN                                                   !2, $12
   15    13        CONCAT                                           ~14     !2, '%0A'
         14        CONCAT                                           ~15     ~14, '%0A'
         15        ECHO                                                     ~15
   17    16        INIT_FCALL                                               'preg_match'
         17        SEND_VAL                                                 '%2F%3E%28%5B%5C%26%5C%23a-zA-Z0-9%5C%3B%5D%2B%29%3C%2F'
         18        SEND_VAR                                                 !2
         19        SEND_REF                                                 !4
         20        DO_ICALL                                         $16     
         21        ASSIGN                                                   !3, $16
   19    22        FETCH_DIM_R                                      ~18     !4, 1
         23        CONCAT                                           ~19     ~18, '%0A'
         24        CONCAT                                           ~20     ~19, '%0A'
         25        ECHO                                                     ~20
   20    26        INIT_FCALL                                               'mb_convert_encoding'
         27        FETCH_DIM_R                                      ~21     !4, 1
         28        SEND_VAL                                                 ~21
         29        SEND_VAL                                                 'UTF-8'
         30        SEND_VAL                                                 'HTML-ENTITIES'
         31        DO_ICALL                                         $22     
         32        ASSIGN                                                   !5, $22
   21    33        CONCAT                                           ~24     !5, '%0A'
         34        CONCAT                                           ~25     ~24, '%0A'
         35        ECHO                                                     ~25
   22    36        INIT_FCALL_BY_NAME                                       'iconv'
         37        SEND_VAL_EX                                              'UTF-8'
         38        SEND_VAL_EX                                              'unicode'
         39        SEND_VAR_EX                                              !5
         40        DO_FCALL                                      0  $26     
         41        CONCAT                                           ~27     $26, '%0A'
         42        CONCAT                                           ~28     ~27, '%0A'
         43        ECHO                                                     ~28
   23    44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
248.43 ms | 1082 KiB | 16 Q