3v4l.org

run code in 500+ 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 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 23
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 23
Branch analysis from position: 36
Branch analysis from position: 23
filename:       /in/984HF
function name:  (null)
number of ops:  41
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                                                          ->32
   13    23    >   INIT_FCALL                                                   'ord'
         24        FETCH_DIM_R                                          ~17     !3, 0
         25        FETCH_DIM_R                                          ~18     ~17, !4
         26        SEND_VAL                                                     ~18
         27        DO_ICALL                                             $19     
         28        FRAMELESS_ICALL_1                dechex              ~20     $19
         29        CONCAT                                               ~21     ~20, '+'
         30        ECHO                                                         ~21
   12    31        PRE_INC                                                      !4
         32    >   FETCH_DIM_R                                          ~23     !3, 0
         33        STRLEN                                               ~24     ~23
         34        IS_SMALLER                                                   !4, ~24
         35      > JMPNZ                                                        ~25, ->23
   15    36    >   ECHO                                                         '%0A'
   16    37        INIT_FCALL                                                   'fclose'
         38        SEND_VAR                                                     !2
         39        DO_ICALL                                                     
   19    40      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
148.6 ms | 3207 KiB | 21 Q