3v4l.org

run code in 300+ PHP versions simultaneously
<?php mb_regex_encoding('SJIS'); $string = mb_convert_encoding("hello ここに文を入れる。", "SJIS", "UTF-8"); $pattern = "hello"; $replacement = 'hi'; //expected result: hi ここに文を入れる。 //but it returns NULL $output = mb_ereg_replace($pattern, $replacement, $string); var_dump(mb_convert_encoding($output, "UTF-8", "SJIS"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Z575v
function name:  (null)
number of ops:  26
compiled vars:  !0 = $string, !1 = $pattern, !2 = $replacement, !3 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'mb_regex_encoding'
          1        SEND_VAL                                                 'SJIS'
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'mb_convert_encoding'
          4        SEND_VAL                                                 'hello+%E3%81%93%E3%81%93%E3%81%AB%E6%96%87%E3%82%92%E5%85%A5%E3%82%8C%E3%82%8B%E3%80%82'
          5        SEND_VAL                                                 'SJIS'
          6        SEND_VAL                                                 'UTF-8'
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !0, $5
    5     9        ASSIGN                                                   !1, 'hello'
    6    10        ASSIGN                                                   !2, 'hi'
    9    11        INIT_FCALL                                               'mb_ereg_replace'
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $9      
         16        ASSIGN                                                   !3, $9
   10    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'mb_convert_encoding'
         19        SEND_VAR                                                 !3
         20        SEND_VAL                                                 'UTF-8'
         21        SEND_VAL                                                 'SJIS'
         22        DO_ICALL                                         $11     
         23        SEND_VAR                                                 $11
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.91 ms | 1395 KiB | 21 Q