3v4l.org

run code in 300+ PHP versions simultaneously
<?php $User = array( 'Name' => "Hans-Peterµµ", 'Contacts' => array(1, 2, 3, 4, 5, 6, 7, 42), 'Active' => 1 ); $J = json_encode(array_utf8_encode($User)); foreach ($J as &$val) { $val = preg_replace_callback('/\\\\u([0-9a-f]{4})/i', function($matches) { return mb_convert_encoding(pack('H*', $matches[1]), 'UTF-8', 'UTF-16'); }, $val);} echo $J; function array_utf8_encode($Array) { foreach($Array as &$Val) { if(is_array($Val)) { $Val = array_utf8_encode($Val); } elseif(is_string($Val)) { $Val = mb_convert_encoding($Val, 'UTF-8'); } } return $Array; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
2 jumps found. (Code = 126) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/DFGjG
function name:  (null)
number of ops:  21
compiled vars:  !0 = $User, !1 = $J, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    6     1        INIT_FCALL                                               'json_encode'
          2        INIT_FCALL_BY_NAME                                       'array_utf8_encode'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $4      
          5        SEND_VAR                                                 $4
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
          8      > FE_RESET_RW                                      $7      !1, ->18
          9    > > FE_FETCH_RW                                              $7, !2, ->18
    7    10    >   INIT_FCALL                                               'preg_replace_callback'
         11        SEND_VAL                                                 '%2F%5C%5Cu%28%5B0-9a-f%5D%7B4%7D%29%2Fi'
    8    12        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDFGjG%3A8%240'
   10    13        SEND_VAL                                                 ~8
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $9      
    7    16        ASSIGN                                                   !2, $9
    6    17      > JMP                                                      ->9
         18    >   FE_FREE                                                  $7
   11    19        ECHO                                                     !1
   35    20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FDFGjG%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DFGjG
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'mb_convert_encoding'
          2        INIT_FCALL                                               'pack'
          3        SEND_VAL                                                 'H%2A'
          4        FETCH_DIM_R                                      ~1      !0, 1
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        SEND_VAL                                                 'UTF-8'
          9        SEND_VAL                                                 'UTF-16'
         10        DO_ICALL                                         $3      
         11      > RETURN                                                   $3
   10    12*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FDFGjG%3A8%240

Function array_utf8_encode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 18
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 17
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/DFGjG
function name:  array_utf8_encode
number of ops:  21
compiled vars:  !0 = $Array, !1 = $Val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1      > FE_RESET_RW                                      $2      !0, ->18
          2    > > FE_FETCH_RW                                              $2, !1, ->18
   19     3    >   TYPE_CHECK                                  128          !1
          4      > JMPZ                                                     ~3, ->10
   21     5    >   INIT_FCALL_BY_NAME                                       'array_utf8_encode'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $4      
          8        ASSIGN                                                   !1, $4
          9      > JMP                                                      ->17
   25    10    >   TYPE_CHECK                                   64          !1
         11      > JMPZ                                                     ~6, ->17
   27    12    >   INIT_FCALL                                               'mb_convert_encoding'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 'UTF-8'
         15        DO_ICALL                                         $7      
         16        ASSIGN                                                   !1, $7
   17    17    > > JMP                                                      ->2
         18    >   FE_FREE                                                  $2
   33    19      > RETURN                                                   !0
   35    20*     > RETURN                                                   null

End of function array_utf8_encode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.16 ms | 1400 KiB | 21 Q