3v4l.org

run code in 300+ PHP versions simultaneously
<?php setlocale(LC_ALL,'C'); $utfchar = chr(0xC3).chr(0x89); // U+009C in UTF-8 $csv = $utfchar."x".$utfchar."x\n"; file_put_contents('test.csv', $csv); $file = fopen('test.csv', 'r'); $data = fgetcsv($file); for ($i = 0; $i < strlen($data[0]); $i++) { echo dechex(ord($data[0][$i])).' '; } echo "\n"; unlink('test.csv'); // expected: c3 89 78 c3 89 78 - "ÉxÉx" // actual: 78 c3 89 78 - "xÉx"
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 24
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 24
Branch analysis from position: 39
Branch analysis from position: 24
filename:       /in/Jhpkh
function name:  (null)
number of ops:  44
compiled vars:  !0 = $utfchar, !1 = $csv, !2 = $file, !3 = $data, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'setlocale'
          1        SEND_VAL                                                 6
          2        SEND_VAL                                                 'C'
          3        DO_ICALL                                                 
    4     4        ASSIGN                                                   !0, '%C3%89'
    6     5        CONCAT                                           ~7      !0, 'x'
          6        CONCAT                                           ~8      ~7, !0
          7        CONCAT                                           ~9      ~8, 'x%0A'
          8        ASSIGN                                                   !1, ~9
    8     9        INIT_FCALL                                               'file_put_contents'
         10        SEND_VAL                                                 'test.csv'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
    9    13        INIT_FCALL                                               'fopen'
         14        SEND_VAL                                                 'test.csv'
         15        SEND_VAL                                                 'r'
         16        DO_ICALL                                         $12     
         17        ASSIGN                                                   !2, $12
   10    18        INIT_FCALL                                               'fgetcsv'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $14     
         21        ASSIGN                                                   !3, $14
   12    22        ASSIGN                                                   !4, 0
         23      > JMP                                                      ->35
   13    24    >   INIT_FCALL                                               'dechex'
         25        INIT_FCALL                                               'ord'
         26        FETCH_DIM_R                                      ~17     !3, 0
         27        FETCH_DIM_R                                      ~18     ~17, !4
         28        SEND_VAL                                                 ~18
         29        DO_ICALL                                         $19     
         30        SEND_VAR                                                 $19
         31        DO_ICALL                                         $20     
         32        CONCAT                                           ~21     $20, '+'
         33        ECHO                                                     ~21
   12    34        PRE_INC                                                  !4
         35    >   FETCH_DIM_R                                      ~23     !3, 0
         36        STRLEN                                           ~24     ~23
         37        IS_SMALLER                                               !4, ~24
         38      > JMPNZ                                                    ~25, ->24
   15    39    >   ECHO                                                     '%0A'
   16    40        INIT_FCALL                                               'unlink'
         41        SEND_VAL                                                 'test.csv'
         42        DO_ICALL                                                 
   19    43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.86 ms | 1400 KiB | 27 Q