3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(function_exists("json_encode")) { $table = get_html_translation_table(HTML_ENTITIES); $table = utf($table); echo json_encode($table); } function is_utf(&$string) { return preg_match('%(?:[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+%xs', $string); } function utf(&$yolo) { if(is_array($yolo)) { $result = array(); foreach($yolo as $yo => &$lo) $result[utf($yo)] = utf($lo); } elseif(is_string($yolo) && !is_utf($yolo)) $result = utf8_encode($yolo); else $result = $yolo; return $result; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/iY1Vu
function name:  (null)
number of ops:  17
compiled vars:  !0 = $table
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'json_encode'
          2        DO_ICALL                                         $1      
          3      > JMPZ                                                     $1, ->16
    4     4    >   INIT_FCALL                                               'get_html_translation_table'
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $2      
          7        ASSIGN                                                   !0, $2
    5     8        INIT_FCALL_BY_NAME                                       'utf'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $4      
         11        ASSIGN                                                   !0, $4
    6    12        INIT_FCALL                                               'json_encode'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $6      
         15        ECHO                                                     $6
   28    16    > > RETURN                                                   1

Function is_utf:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iY1Vu
function name:  is_utf
number of ops:  7
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%25%28%3F%3A%5B%5CxC2-%5CxDF%5D%5B%5Cx80-%5CxBF%5D%7C%5CxE0%5B%5CxA0-%5CxBF%5D%5B%5Cx80-%5CxBF%5D%7C%5B%5CxE1-%5CxEC%5CxEE%5CxEF%5D%5B%5Cx80-%5CxBF%5D%7B2%7D%7C%5CxED%5B%5Cx80-%5Cx9F%5D%5B%5Cx80-%5CxBF%5D%7C%5CxF0%5B%5Cx90-%5CxBF%5D%5B%5Cx80-%5CxBF%5D%7B2%7D%7C%5B%5CxF1-%5CxF3%5D%5B%5Cx80-%5CxBF%5D%7B3%7D%7C%5CxF4%5B%5Cx80-%5Cx8F%5D%5B%5Cx80-%5CxBF%5D%7B2%7D%29%2B%25xs'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
   13     6*     > RETURN                                                   null

End of function is_utf

Function utf:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 125) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 126) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/iY1Vu
function name:  utf
number of ops:  34
compiled vars:  !0 = $yolo, !1 = $result, !2 = $lo, !3 = $yo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~4, ->18
   19     3    >   ASSIGN                                                   !1, <array>
   20     4      > FE_RESET_RW                                      $6      !0, ->16
          5    > > FE_FETCH_RW                                      ~7      $6, !2, ->16
          6    >   ASSIGN                                                   !3, ~7
   21     7        INIT_FCALL_BY_NAME                                       'utf'
          8        SEND_VAR_EX                                              !3
          9        DO_FCALL                                      0  $9      
         10        INIT_FCALL_BY_NAME                                       'utf'
         11        SEND_VAR_EX                                              !2
         12        DO_FCALL                                      0  $11     
         13        ASSIGN_DIM                                               !1, $9
         14        OP_DATA                                                  $11
   20    15      > JMP                                                      ->5
         16    >   FE_FREE                                                  $6
         17      > JMP                                                      ->32
   23    18    >   TYPE_CHECK                                   64  ~12     !0
         19      > JMPZ_EX                                          ~12     ~12, ->25
         20    >   INIT_FCALL                                               'is_utf'
         21        SEND_REF                                                 !0
         22        DO_FCALL                                      0  $13     
         23        BOOL_NOT                                         ~14     $13
         24        BOOL                                             ~12     ~14
         25    > > JMPZ                                                     ~12, ->31
   24    26    >   INIT_FCALL                                               'utf8_encode'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                         $15     
         29        ASSIGN                                                   !1, $15
         30      > JMP                                                      ->32
   26    31    >   ASSIGN                                                   !1, !0
   27    32    > > RETURN                                                   !1
   28    33*     > RETURN                                                   null

End of function utf

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.85 ms | 1403 KiB | 24 Q