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', 'auto'); } } 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/SZVBM
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>
    7     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
    9     8      > FE_RESET_RW                                      $7      !1, ->18
          9    > > FE_FETCH_RW                                              $7, !2, ->18
   10    10    >   INIT_FCALL                                               'preg_replace_callback'
         11        SEND_VAL                                                 '%2F%5C%5Cu%28%5B0-9a-f%5D%7B4%7D%29%2Fi'
   11    12        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FSZVBM%3A11%240'
   13    13        SEND_VAL                                                 ~8
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $9      
   10    16        ASSIGN                                                   !2, $9
    9    17      > JMP                                                      ->9
         18    >   FE_FREE                                                  $7
   16    19        ECHO                                                     !1
   36    20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FSZVBM%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SZVBM
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     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
   13    12*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FSZVBM%3A11%240

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

End of function array_utf8_encode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.15 ms | 1392 KiB | 21 Q