3v4l.org

run code in 300+ PHP versions simultaneously
<?php $utf8_str = "苫小牧"; echo 'UTF-8 as hex: ' . bin2hex($utf8_str) . PHP_EOL; $sjis_str = mb_convert_encoding($utf8_str, 'SJIS', 'UTF-8'); echo 'SJIS as hex: ' . bin2hex($sjis_str) . PHP_EOL; // detect encoding of $str $encode = mb_detect_encoding($sjis_str, 'EUC-JP,UTF-8,SJIS'); echo 'Detected encoding: ' . $encode . PHP_EOL; $euc_str = mb_convert_encoding( $sjis_str, "EUC-JP",$encode); echo 'EUC as hex: ' . bin2hex($euc_str) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KKf2h
function name:  (null)
number of ops:  40
compiled vars:  !0 = $utf8_str, !1 = $sjis_str, !2 = $encode, !3 = $euc_str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%E8%8B%AB%E5%B0%8F%E7%89%A7'
    4     1        INIT_FCALL                                               'bin2hex'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        CONCAT                                           ~6      'UTF-8+as+hex%3A+', $5
          5        CONCAT                                           ~7      ~6, '%0A'
          6        ECHO                                                     ~7
    6     7        INIT_FCALL                                               'mb_convert_encoding'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'SJIS'
         10        SEND_VAL                                                 'UTF-8'
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !1, $8
    7    13        INIT_FCALL                                               'bin2hex'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $10     
         16        CONCAT                                           ~11     'SJIS+as+hex%3A+', $10
         17        CONCAT                                           ~12     ~11, '%0A'
         18        ECHO                                                     ~12
   10    19        INIT_FCALL                                               'mb_detect_encoding'
         20        SEND_VAR                                                 !1
         21        SEND_VAL                                                 'EUC-JP%2CUTF-8%2CSJIS'
         22        DO_ICALL                                         $13     
         23        ASSIGN                                                   !2, $13
   11    24        CONCAT                                           ~15     'Detected+encoding%3A+', !2
         25        CONCAT                                           ~16     ~15, '%0A'
         26        ECHO                                                     ~16
   13    27        INIT_FCALL                                               'mb_convert_encoding'
         28        SEND_VAR                                                 !1
         29        SEND_VAL                                                 'EUC-JP'
         30        SEND_VAR                                                 !2
         31        DO_ICALL                                         $17     
         32        ASSIGN                                                   !3, $17
   14    33        INIT_FCALL                                               'bin2hex'
         34        SEND_VAR                                                 !3
         35        DO_ICALL                                         $19     
         36        CONCAT                                           ~20     'EUC+as+hex%3A+', $19
         37        CONCAT                                           ~21     ~20, '%0A'
         38        ECHO                                                     ~21
   15    39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.92 ms | 1008 KiB | 16 Q