3v4l.org

run code in 300+ PHP versions simultaneously
<?php $charset = 'UTF-8'; // PHP Meh. $encoding = 'UTF-8'; header('Content-Type: application/xml; charset=' . $charset); ini_set('default_charset', $charset); mb_internal_encoding('UTF-8'); $rawUtf8Text = '豁ヲ蠢・'; $encodedText = mb_encode_numericentity($rawUtf8Text, [0x0, 0xffff, 0, 0xffff], 'UTF-8'); $clearText = mb_decode_numericentity($encodedText, [0x0, 0xffff, 0, 0xffff], 'UTF-8'); echo "RAW UTF-8 STRING: {$clearText}\nNUMERICALLY ENCODED STRING: {$encodedText}\nROUND TRIP ENCODE/DECODE STRING: {$clearText}\n"; $xml = '<first-name>' . $encodedText . '</first-name>'; echo "ENCODED XML TO BE PARSED:{$xml}\n"; $decodedFromXml = mb_decode_numericentity(strip_tags($encodedText), [0x0, 0xffff, 0, 0xffff], 'UTF-8'); echo "DECODED STRING FROM XML: {$decodedFromXml}\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dr1m6
function name:  (null)
number of ops:  55
compiled vars:  !0 = $charset, !1 = $encoding, !2 = $rawUtf8Text, !3 = $encodedText, !4 = $clearText, !5 = $xml, !6 = $decodedFromXml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'UTF-8'
    3     1        ASSIGN                                                   !1, 'UTF-8'
    5     2        INIT_FCALL                                               'header'
          3        CONCAT                                           ~9      'Content-Type%3A+application%2Fxml%3B+charset%3D', !0
          4        SEND_VAL                                                 ~9
          5        DO_ICALL                                                 
    6     6        INIT_FCALL                                               'ini_set'
          7        SEND_VAL                                                 'default_charset'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
    7    10        INIT_FCALL                                               'mb_internal_encoding'
         11        SEND_VAL                                                 'UTF-8'
         12        DO_ICALL                                                 
    9    13        ASSIGN                                                   !2, '%E8%B1%81%EF%BD%A6%E8%A0%A2%E3%83%BB'
   10    14        INIT_FCALL                                               'mb_encode_numericentity'
         15        SEND_VAR                                                 !2
         16        SEND_VAL                                                 <array>
         17        SEND_VAL                                                 'UTF-8'
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !3, $14
   11    20        INIT_FCALL                                               'mb_decode_numericentity'
         21        SEND_VAR                                                 !3
         22        SEND_VAL                                                 <array>
         23        SEND_VAL                                                 'UTF-8'
         24        DO_ICALL                                         $16     
         25        ASSIGN                                                   !4, $16
   13    26        ROPE_INIT                                     7  ~19     'RAW+UTF-8+STRING%3A+'
         27        ROPE_ADD                                      1  ~19     ~19, !4
         28        ROPE_ADD                                      2  ~19     ~19, '%0ANUMERICALLY+ENCODED+STRING%3A+'
         29        ROPE_ADD                                      3  ~19     ~19, !3
         30        ROPE_ADD                                      4  ~19     ~19, '%0AROUND+TRIP+ENCODE%2FDECODE+STRING%3A+'
         31        ROPE_ADD                                      5  ~19     ~19, !4
         32        ROPE_END                                      6  ~18     ~19, '%0A'
         33        ECHO                                                     ~18
   15    34        CONCAT                                           ~23     '%3Cfirst-name%3E', !3
         35        CONCAT                                           ~24     ~23, '%3C%2Ffirst-name%3E'
         36        ASSIGN                                                   !5, ~24
   16    37        ROPE_INIT                                     3  ~27     'ENCODED+XML+TO+BE+PARSED%3A'
         38        ROPE_ADD                                      1  ~27     ~27, !5
         39        ROPE_END                                      2  ~26     ~27, '%0A'
         40        ECHO                                                     ~26
   17    41        INIT_FCALL                                               'mb_decode_numericentity'
         42        INIT_FCALL                                               'strip_tags'
         43        SEND_VAR                                                 !3
         44        DO_ICALL                                         $29     
         45        SEND_VAR                                                 $29
         46        SEND_VAL                                                 <array>
         47        SEND_VAL                                                 'UTF-8'
         48        DO_ICALL                                         $30     
         49        ASSIGN                                                   !6, $30
   18    50        ROPE_INIT                                     3  ~33     'DECODED+STRING+FROM+XML%3A+'
         51        ROPE_ADD                                      1  ~33     ~33, !6
         52        ROPE_END                                      2  ~32     ~33, '%0A'
         53        ECHO                                                     ~32
         54      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.12 ms | 1443 KiB | 19 Q