3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "\xC4\xA2"; // The string is valid in all three encodings, so the first one listed will be returned var_dump(mb_detect_encoding($str, ['UTF-8', 'ISO-8859-1', 'ISO-8859-5'])); var_dump(mb_detect_encoding($str, ['ISO-8859-1', 'ISO-8859-5', 'UTF-8'])); var_dump(mb_detect_encoding($str, ['ISO-8859-5', 'UTF-8', 'ISO-8859-1']));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sfhUa
function name:  (null)
number of ops:  23
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%C4%A2'
    6     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'mb_detect_encoding'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <array>
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
    7     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'mb_detect_encoding'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 <array>
         12        DO_ICALL                                         $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                                 
    8    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'mb_detect_encoding'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 <array>
         19        DO_ICALL                                         $6      
         20        SEND_VAR                                                 $6
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.05 ms | 1005 KiB | 15 Q