3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "\x96"; // en-dash in Windows-1252 var_dump(mb_check_encoding($str, "UTF-8")); var_dump(mb_check_encoding($str, "ISO-8859-1")); var_dump(mb_check_encoding($str, "Windows-1252")); var_dump(mb_detect_encoding($str, [ "UTF-8", "ISO-8859-1", "Windows-1252"], true)); var_dump(mb_detect_encoding($str, [ "UTF-8", "Windows-1252", "ISO-8859-1"], true));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3SJWk
function name:  (null)
number of ops:  39
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%96'
    3     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'mb_check_encoding'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'UTF-8'
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
    4     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'mb_check_encoding'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 'ISO-8859-1'
         12        DO_ICALL                                         $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                                 
    5    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'mb_check_encoding'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 'Windows-1252'
         19        DO_ICALL                                         $6      
         20        SEND_VAR                                                 $6
         21        DO_ICALL                                                 
    6    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'mb_detect_encoding'
         24        SEND_VAR                                                 !0
         25        SEND_VAL                                                 <array>
         26        SEND_VAL                                                 <true>
         27        DO_ICALL                                         $8      
         28        SEND_VAR                                                 $8
         29        DO_ICALL                                                 
    7    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'mb_detect_encoding'
         32        SEND_VAR                                                 !0
         33        SEND_VAL                                                 <array>
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $10     
         36        SEND_VAR                                                 $10
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.9 ms | 1017 KiB | 16 Q