3v4l.org

run code in 500+ PHP versions simultaneously
<?php $differences = []; for ($_1 = 0; $_1 <= 0xff; $_1++) { $first_byte = chr($_1); for ($_2 = 0; $_2 <= 0xff; $_2++) { $second_byte = chr($_2); $two_bytes_sequence = $first_byte . $second_byte; assert( mb_convert_encoding($two_bytes_sequence, 'UTF-8', 'CP932') === mb_convert_encoding($two_bytes_sequence, 'UTF-8', 'SJIS-win') ); $cp932 = mb_convert_encoding($two_bytes_sequence, 'CP932', 'UCS-2'); $sjis_win = mb_convert_encoding($two_bytes_sequence, 'SJIS-win', 'UCS-2'); if ($cp932 !== $sjis_win) { $differences[] = [ sprintf('%02x', $_1), sprintf('%02x', $_2), mb_convert_encoding($two_bytes_sequence, 'UTF-8', 'UCS-2'), $cp932, array_map(fn ($byte) => sprintf('%02x', ord($byte)), str_split($cp932)), $sjis_win, array_map(fn ($byte) => sprintf('%02x', ord($byte)), str_split($sjis_win)), ]; } } } var_dump($differences);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 87
Branch analysis from position: 87
2 jumps found. (Code = 44) Position 1 = 89, Position 2 = 3
Branch analysis from position: 89
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
2 jumps found. (Code = 44) Position 1 = 86, Position 2 = 9
Branch analysis from position: 86
2 jumps found. (Code = 44) Position 1 = 89, Position 2 = 3
Branch analysis from position: 89
Branch analysis from position: 3
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 83
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 86, Position 2 = 9
Branch analysis from position: 86
Branch analysis from position: 9
Branch analysis from position: 83
filename:       /in/lQpnG
function name:  (null)
number of ops:  93
compiled vars:  !0 = $differences, !1 = $_1, !2 = $first_byte, !3 = $_2, !4 = $second_byte, !5 = $two_bytes_sequence, !6 = $cp932, !7 = $sjis_win
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    5     1        ASSIGN                                                       !1, 0
          2      > JMP                                                          ->87
    6     3    >   INIT_FCALL                                                   'chr'
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $10     
          6        ASSIGN                                                       !2, $10
    7     7        ASSIGN                                                       !3, 0
          8      > JMP                                                          ->84
    8     9    >   INIT_FCALL                                                   'chr'
         10        SEND_VAR                                                     !3
         11        DO_ICALL                                             $13     
         12        ASSIGN                                                       !4, $13
    9    13        CONCAT                                               ~15     !2, !4
         14        ASSIGN                                                       !5, ~15
   11    15        ASSERT_CHECK                                                 
         16        INIT_FCALL                                                   'assert'
   12    17        INIT_FCALL                                                   'mb_convert_encoding'
         18        SEND_VAR                                                     !5
         19        SEND_VAL                                                     'UTF-8'
         20        SEND_VAL                                                     'CP932'
         21        DO_ICALL                                             $17     
   14    22        INIT_FCALL                                                   'mb_convert_encoding'
         23        SEND_VAR                                                     !5
         24        SEND_VAL                                                     'UTF-8'
         25        SEND_VAL                                                     'SJIS-win'
         26        DO_ICALL                                             $18     
         27        IS_IDENTICAL                                         ~19     $17, $18
         28        SEND_VAL                                                     ~19
   11    29        SEND_VAL                                                     'assert%28mb_convert_encoding%28%24two_bytes_sequence%2C+%27UTF-8%27%2C+%27CP932%27%29+%3D%3D%3D+mb_convert_encoding%28%24two_bytes_sequence%2C+%27UTF-8%27%2C+%27SJIS-win%27%29%29'
         30        DO_ICALL                                                     
   17    31        INIT_FCALL                                                   'mb_convert_encoding'
         32        SEND_VAR                                                     !5
         33        SEND_VAL                                                     'CP932'
         34        SEND_VAL                                                     'UCS-2'
         35        DO_ICALL                                             $21     
         36        ASSIGN                                                       !6, $21
   18    37        INIT_FCALL                                                   'mb_convert_encoding'
         38        SEND_VAR                                                     !5
         39        SEND_VAL                                                     'SJIS-win'
         40        SEND_VAL                                                     'UCS-2'
         41        DO_ICALL                                             $23     
         42        ASSIGN                                                       !7, $23
   19    43        IS_NOT_IDENTICAL                                             !6, !7
         44      > JMPZ                                                         ~25, ->83
   21    45    >   INIT_FCALL                                                   'sprintf'
         46        SEND_VAL                                                     '%2502x'
         47        SEND_VAR                                                     !1
         48        DO_ICALL                                             $27     
         49        INIT_ARRAY                                           ~28     $27
   22    50        INIT_FCALL                                                   'sprintf'
         51        SEND_VAL                                                     '%2502x'
         52        SEND_VAR                                                     !3
         53        DO_ICALL                                             $29     
         54        ADD_ARRAY_ELEMENT                                    ~28     $29
   23    55        INIT_FCALL                                                   'mb_convert_encoding'
         56        SEND_VAR                                                     !5
         57        SEND_VAL                                                     'UTF-8'
         58        SEND_VAL                                                     'UCS-2'
         59        DO_ICALL                                             $30     
         60        ADD_ARRAY_ELEMENT                                    ~28     $30
   24    61        ADD_ARRAY_ELEMENT                                    ~28     !6
   25    62        INIT_FCALL                                                   'array_map'
         63        DECLARE_LAMBDA_FUNCTION                              ~31     [0]
         64        SEND_VAL                                                     ~31
         65        INIT_FCALL                                                   'str_split'
         66        SEND_VAR                                                     !6
         67        DO_ICALL                                             $32     
         68        SEND_VAR                                                     $32
         69        DO_ICALL                                             $33     
         70        ADD_ARRAY_ELEMENT                                    ~28     $33
   26    71        ADD_ARRAY_ELEMENT                                    ~28     !7
   27    72        INIT_FCALL                                                   'array_map'
         73        DECLARE_LAMBDA_FUNCTION                              ~34     [1]
         74        SEND_VAL                                                     ~34
         75        INIT_FCALL                                                   'str_split'
         76        SEND_VAR                                                     !7
         77        DO_ICALL                                             $35     
         78        SEND_VAR                                                     $35
         79        DO_ICALL                                             $36     
         80        ADD_ARRAY_ELEMENT                                    ~28     $36
   20    81        ASSIGN_DIM                                                   !0
   27    82        OP_DATA                                                      ~28
    7    83    >   PRE_INC                                                      !3
         84    >   IS_SMALLER_OR_EQUAL                                          !3, 255
         85      > JMPNZ                                                        ~38, ->9
    5    86    >   PRE_INC                                                      !1
         87    >   IS_SMALLER_OR_EQUAL                                          !1, 255
         88      > JMPNZ                                                        ~40, ->3
   33    89    >   INIT_FCALL                                                   'var_dump'
         90        SEND_VAR                                                     !0
         91        DO_ICALL                                                     
         92      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lQpnG
function name:  {closure:/in/lQpnG:25}
number of ops:  10
compiled vars:  !0 = $byte
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   RECV                                                 !0      
          1        INIT_FCALL                                                   'sprintf'
          2        SEND_VAL                                                     '%2502x'
          3        INIT_FCALL                                                   'ord'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $1      
          6        SEND_VAR                                                     $1
          7        DO_ICALL                                             $2      
          8      > RETURN                                                       $2
          9*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lQpnG
function name:  {closure:/in/lQpnG:27}
number of ops:  10
compiled vars:  !0 = $byte
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   RECV                                                 !0      
          1        INIT_FCALL                                                   'sprintf'
          2        SEND_VAL                                                     '%2502x'
          3        INIT_FCALL                                                   'ord'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $1      
          6        SEND_VAR                                                     $1
          7        DO_ICALL                                             $2      
          8      > RETURN                                                       $2
          9*     > RETURN                                                       null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
118.23 ms | 494 KiB | 15 Q