3v4l.org

run code in 300+ PHP versions simultaneously
<?php // This returns as expected. $str = "\xf8foo"; var_dump( mb_detect_encoding($str, 'UTF-8'), // bool(false) mb_detect_encoding($str, 'UTF-8', true) // bool(false) ); // This does not. $str = "foo\xf8"; var_dump( mb_detect_encoding($str, 'UTF-8'), // string(5) "UTF-8" mb_detect_encoding($str, 'UTF-8', true) // bool(false) ); // Nor does this. $str = "\xe1\xe9\xf3\xfa"; var_dump( mb_detect_encoding($str, 'UTF-8'), // string(5) "UTF-8" mb_detect_encoding($str, 'UTF-8', true) // bool(false) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b9b6q
function name:  (null)
number of ops:  43
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, '%F8foo'
    6     1        INIT_FCALL                                               'var_dump'
    7     2        INIT_FCALL                                               'mb_detect_encoding'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'UTF-8'
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
    8     7        INIT_FCALL                                               'mb_detect_encoding'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'UTF-8'
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $3      
         12        SEND_VAR                                                 $3
         13        DO_ICALL                                                 
   12    14        ASSIGN                                                   !0, 'foo%F8'
   13    15        INIT_FCALL                                               'var_dump'
   14    16        INIT_FCALL                                               'mb_detect_encoding'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 'UTF-8'
         19        DO_ICALL                                         $6      
         20        SEND_VAR                                                 $6
   15    21        INIT_FCALL                                               'mb_detect_encoding'
         22        SEND_VAR                                                 !0
         23        SEND_VAL                                                 'UTF-8'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $7      
         26        SEND_VAR                                                 $7
         27        DO_ICALL                                                 
   19    28        ASSIGN                                                   !0, '%E1%E9%F3%FA'
   20    29        INIT_FCALL                                               'var_dump'
   21    30        INIT_FCALL                                               'mb_detect_encoding'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 'UTF-8'
         33        DO_ICALL                                         $10     
         34        SEND_VAR                                                 $10
   22    35        INIT_FCALL                                               'mb_detect_encoding'
         36        SEND_VAR                                                 !0
         37        SEND_VAL                                                 'UTF-8'
         38        SEND_VAL                                                 <true>
         39        DO_ICALL                                         $11     
         40        SEND_VAR                                                 $11
         41        DO_ICALL                                                 
   23    42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.93 ms | 1396 KiB | 17 Q