3v4l.org

run code in 300+ PHP versions simultaneously
<?php $encodings = [ 'BASE64', 'HTML-ENTITIES', 'Quoted-Printable', 'UTF-16', 'UTF-16BE', 'UTF-16LE', 'UTF-7', 'UTF7-IMAP', 'JIS', 'ISO-2022-JP', 'ISO-2022-JP-MS', 'GB18030', 'HZ', 'ISO-2022-KR', 'ISO-2022-JP-2004', 'ISO-2022-JP-MOBILE#KDDI', 'CP50220', 'CP50221', 'CP50222', ]; $input = '宛如繁星般宛如皎月般'; $bytes_length = 15; foreach($encodings as $encoding) { $converted_str = mb_convert_encoding($input, $encoding, mb_internal_encoding()); $cut_str = mb_strcut($converted_str, 0, $bytes_length, $encoding); $reconverted_str = mb_convert_encoding($cut_str, mb_internal_encoding(), $encoding); echo $encoding.': '.$reconverted_str.PHP_EOL; } echo PHP_EOL; $input = '星のように月のように'; $bytes_length = 20; foreach($encodings as $encoding) { $converted_str = mb_convert_encoding($input, $encoding, mb_internal_encoding()); $cut_str = mb_strcut($converted_str, 0, $bytes_length, $encoding); $reconverted_str = mb_convert_encoding($cut_str, mb_internal_encoding(), $encoding); echo $encoding.': '.$reconverted_str.PHP_EOL; } echo PHP_EOL; $input = 'あaいb'; $bytes_length = 10; foreach($encodings as $encoding) { $converted_str = mb_convert_encoding($input, $encoding, mb_internal_encoding()); $cut_str = mb_strcut($converted_str, 0, $bytes_length, $encoding); $reconverted_str = mb_convert_encoding($cut_str, mb_internal_encoding(), $encoding); echo $encoding.': '.$reconverted_str.PHP_EOL; } echo PHP_EOL; $input = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'; $bytes_length = 10; foreach($encodings as $encoding) { $converted_str = mb_convert_encoding($input, $encoding, mb_internal_encoding()); $cut_str = mb_strcut($converted_str, 0, $bytes_length, $encoding); $reconverted_str = mb_convert_encoding($cut_str, mb_internal_encoding(), $encoding); echo $encoding.': '.$reconverted_str.PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 33
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 33
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 33
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 67
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 67
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 67
2 jumps found. (Code = 77) Position 1 = 72, Position 2 = 101
Branch analysis from position: 72
2 jumps found. (Code = 78) Position 1 = 73, Position 2 = 101
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
Branch analysis from position: 101
2 jumps found. (Code = 77) Position 1 = 106, Position 2 = 135
Branch analysis from position: 106
2 jumps found. (Code = 78) Position 1 = 107, Position 2 = 135
Branch analysis from position: 107
1 jumps found. (Code = 42) Position 1 = 106
Branch analysis from position: 106
Branch analysis from position: 135
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 135
Branch analysis from position: 101
Branch analysis from position: 67
Branch analysis from position: 33
filename:       /in/tL90V
function name:  (null)
number of ops:  137
compiled vars:  !0 = $encodings, !1 = $input, !2 = $bytes_length, !3 = $encoding, !4 = $converted_str, !5 = $cut_str, !6 = $reconverted_str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   24     1        ASSIGN                                                   !1, '%E5%AE%9B%E5%A6%82%E7%B9%81%E6%98%9F%E8%88%AC%E5%AE%9B%E5%A6%82%E7%9A%8E%E6%9C%88%E8%88%AC'
   25     2        ASSIGN                                                   !2, 15
   26     3      > FE_RESET_R                                       $10     !0, ->33
          4    > > FE_FETCH_R                                               $10, !3, ->33
   27     5    >   INIT_FCALL                                               'mb_convert_encoding'
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !3
          8        INIT_FCALL                                               'mb_internal_encoding'
          9        DO_ICALL                                         $11     
         10        SEND_VAR                                                 $11
         11        DO_ICALL                                         $12     
         12        ASSIGN                                                   !4, $12
   28    13        INIT_FCALL                                               'mb_strcut'
         14        SEND_VAR                                                 !4
         15        SEND_VAL                                                 0
         16        SEND_VAR                                                 !2
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !5, $14
   29    20        INIT_FCALL                                               'mb_convert_encoding'
         21        SEND_VAR                                                 !5
         22        INIT_FCALL                                               'mb_internal_encoding'
         23        DO_ICALL                                         $16     
         24        SEND_VAR                                                 $16
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                         $17     
         27        ASSIGN                                                   !6, $17
   30    28        CONCAT                                           ~19     !3, '%3A+'
         29        CONCAT                                           ~20     ~19, !6
         30        CONCAT                                           ~21     ~20, '%0A'
         31        ECHO                                                     ~21
   26    32      > JMP                                                      ->4
         33    >   FE_FREE                                                  $10
   33    34        ECHO                                                     '%0A'
   35    35        ASSIGN                                                   !1, '%E6%98%9F%E3%81%AE%E3%82%88%E3%81%86%E3%81%AB%E6%9C%88%E3%81%AE%E3%82%88%E3%81%86%E3%81%AB'
   36    36        ASSIGN                                                   !2, 20
   37    37      > FE_RESET_R                                       $24     !0, ->67
         38    > > FE_FETCH_R                                               $24, !3, ->67
   38    39    >   INIT_FCALL                                               'mb_convert_encoding'
         40        SEND_VAR                                                 !1
         41        SEND_VAR                                                 !3
         42        INIT_FCALL                                               'mb_internal_encoding'
         43        DO_ICALL                                         $25     
         44        SEND_VAR                                                 $25
         45        DO_ICALL                                         $26     
         46        ASSIGN                                                   !4, $26
   39    47        INIT_FCALL                                               'mb_strcut'
         48        SEND_VAR                                                 !4
         49        SEND_VAL                                                 0
         50        SEND_VAR                                                 !2
         51        SEND_VAR                                                 !3
         52        DO_ICALL                                         $28     
         53        ASSIGN                                                   !5, $28
   40    54        INIT_FCALL                                               'mb_convert_encoding'
         55        SEND_VAR                                                 !5
         56        INIT_FCALL                                               'mb_internal_encoding'
         57        DO_ICALL                                         $30     
         58        SEND_VAR                                                 $30
         59        SEND_VAR                                                 !3
         60        DO_ICALL                                         $31     
         61        ASSIGN                                                   !6, $31
   41    62        CONCAT                                           ~33     !3, '%3A+'
         63        CONCAT                                           ~34     ~33, !6
         64        CONCAT                                           ~35     ~34, '%0A'
         65        ECHO                                                     ~35
   37    66      > JMP                                                      ->38
         67    >   FE_FREE                                                  $24
   44    68        ECHO                                                     '%0A'
   46    69        ASSIGN                                                   !1, '%E3%81%82a%E3%81%84b'
   47    70        ASSIGN                                                   !2, 10
   48    71      > FE_RESET_R                                       $38     !0, ->101
         72    > > FE_FETCH_R                                               $38, !3, ->101
   49    73    >   INIT_FCALL                                               'mb_convert_encoding'
         74        SEND_VAR                                                 !1
         75        SEND_VAR                                                 !3
         76        INIT_FCALL                                               'mb_internal_encoding'
         77        DO_ICALL                                         $39     
         78        SEND_VAR                                                 $39
         79        DO_ICALL                                         $40     
         80        ASSIGN                                                   !4, $40
   50    81        INIT_FCALL                                               'mb_strcut'
         82        SEND_VAR                                                 !4
         83        SEND_VAL                                                 0
         84        SEND_VAR                                                 !2
         85        SEND_VAR                                                 !3
         86        DO_ICALL                                         $42     
         87        ASSIGN                                                   !5, $42
   51    88        INIT_FCALL                                               'mb_convert_encoding'
         89        SEND_VAR                                                 !5
         90        INIT_FCALL                                               'mb_internal_encoding'
         91        DO_ICALL                                         $44     
         92        SEND_VAR                                                 $44
         93        SEND_VAR                                                 !3
         94        DO_ICALL                                         $45     
         95        ASSIGN                                                   !6, $45
   52    96        CONCAT                                           ~47     !3, '%3A+'
         97        CONCAT                                           ~48     ~47, !6
         98        CONCAT                                           ~49     ~48, '%0A'
         99        ECHO                                                     ~49
   48   100      > JMP                                                      ->72
        101    >   FE_FREE                                                  $38
   55   102        ECHO                                                     '%0A'
   57   103        ASSIGN                                                   !1, 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
   58   104        ASSIGN                                                   !2, 10
   59   105      > FE_RESET_R                                       $52     !0, ->135
        106    > > FE_FETCH_R                                               $52, !3, ->135
   60   107    >   INIT_FCALL                                               'mb_convert_encoding'
        108        SEND_VAR                                                 !1
        109        SEND_VAR                                                 !3
        110        INIT_FCALL                                               'mb_internal_encoding'
        111        DO_ICALL                                         $53     
        112        SEND_VAR                                                 $53
        113        DO_ICALL                                         $54     
        114        ASSIGN                                                   !4, $54
   61   115        INIT_FCALL                                               'mb_strcut'
        116        SEND_VAR                                                 !4
        117        SEND_VAL                                                 0
        118        SEND_VAR                                                 !2
        119        SEND_VAR                                                 !3
        120        DO_ICALL                                         $56     
        121        ASSIGN                                                   !5, $56
   62   122        INIT_FCALL                                               'mb_convert_encoding'
        123        SEND_VAR                                                 !5
        124        INIT_FCALL                                               'mb_internal_encoding'
        125        DO_ICALL                                         $58     
        126        SEND_VAR                                                 $58
        127        SEND_VAR                                                 !3
        128        DO_ICALL                                         $59     
        129        ASSIGN                                                   !6, $59
   63   130        CONCAT                                           ~61     !3, '%3A+'
        131        CONCAT                                           ~62     ~61, !6
        132        CONCAT                                           ~63     ~62, '%0A'
        133        ECHO                                                     ~63
   59   134      > JMP                                                      ->106
        135    >   FE_FREE                                                  $52
   64   136      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.65 ms | 1015 KiB | 16 Q