3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.95 ms | 1404 KiB | 27 Q