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 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 23
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 23
Branch analysis from position: 39
Branch analysis from position: 23
filename:       /in/984HF
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 >   QM_ASSIGN                                                !0
   5     1        CONCAT                                           ~6      !0, 'x'
         2        CONCAT                                           ~7      ~6, !0
         3        CONCAT                                           ~8      ~7, 'x%0A'
         4        QM_ASSIGN                                                !1
   7     5        INIT_FCALL                                               'fopen'
         6        SEND_VAL                                                 'php%3A%2F%2Fmemory'
         7        SEND_VAL                                                 'w%2B'
         8        DO_ICALL                                         $10     
         9        QM_ASSIGN                                                !2
   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        QM_ASSIGN                                                !3
  12    21        QM_ASSIGN                                                !4
        22      > JMP                                                      ->35
  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        ASSIGN_OBJ                                               ~21
  12    33        POST_INC                                         ~22     !4
        34        FREE                                                     ~22
        35    >   FETCH_DIM_R                                      ~23     !3, 0
        36        STRLEN                                           ~24     ~23
        37        IS_SMALLER_OR_EQUAL                              ~25     !4, ~24
        38      > JMPNZ                                                    ~25, ->23
  15    39    >   ASSIGN_OBJ                                               '%0A'
  16    40        INIT_FCALL                                               'fclose'
        41        SEND_VAR                                                 !2
        42        DO_ICALL                                                 
  19    43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
14.71 ms | 904 KiB | 7 Q