3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.08 ms | 2435 KiB | 15 Q