3v4l.org

run code in 300+ PHP versions simultaneously
<?php if ( !function_exists( 'mb_convert_encoding' ) ) { exit('[mbstring not loaded]'); } $oldSub = mb_substitute_character(); mb_substitute_character( 0xfffd ); $res = mb_convert_encoding( "\xf4\x90\x80\x80 \xc2", 'UTF-8', 'UTF-8' ); mb_substitute_character( $oldSub ); if ( $res === "\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd" ) { // mbstring follows best practices. $level = 3; } elseif ( $res[0] !== "\xef" ) { // mbstring is old; it treats values above U+10FFFF as valid. // This is the case for PHP 5.3. $level = 0; } elseif ( substr_compare( $res, " \xef\xbf\xbd", -4 ) !== 0 ) { // mbstring is affected by <https://bugs.php.net/bug.php?id=65045>. $level = 1; } else { // mbstring nevertheless doesn't follow best practices. (Perhaps this system // has an old version of ICU, and mbstring was changed to use it.) $level = 2; } echo $level;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yjsdt
function name:  (null)
number of ops:  42
compiled vars:  !0 = $oldSub, !1 = $res, !2 = $level
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'mb_convert_encoding'
          2        DO_ICALL                                         $3      
          3        BOOL_NOT                                         ~4      $3
          4      > JMPZ                                                     ~4, ->6
    4     5    > > EXIT                                                     '%5Bmbstring+not+loaded%5D'
    7     6    >   INIT_FCALL                                               'mb_substitute_character'
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !0, $5
    8     9        INIT_FCALL                                               'mb_substitute_character'
         10        SEND_VAL                                                 65533
         11        DO_ICALL                                                 
    9    12        INIT_FCALL                                               'mb_convert_encoding'
         13        SEND_VAL                                                 '%F4%90%80%80+%C2'
         14        SEND_VAL                                                 'UTF-8'
         15        SEND_VAL                                                 'UTF-8'
         16        DO_ICALL                                         $8      
         17        ASSIGN                                                   !1, $8
   10    18        INIT_FCALL                                               'mb_substitute_character'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
   12    21        IS_IDENTICAL                                             !1, '%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD+%EF%BF%BD'
         22      > JMPZ                                                     ~11, ->25
   14    23    >   ASSIGN                                                   !2, 3
         24      > JMP                                                      ->40
   15    25    >   FETCH_DIM_R                                      ~13     !1, 0
         26        IS_NOT_IDENTICAL                                         ~13, '%EF'
         27      > JMPZ                                                     ~14, ->30
   18    28    >   ASSIGN                                                   !2, 0
         29      > JMP                                                      ->40
   19    30    >   INIT_FCALL                                               'substr_compare'
         31        SEND_VAR                                                 !1
         32        SEND_VAL                                                 '+%EF%BF%BD'
         33        SEND_VAL                                                 -4
         34        DO_ICALL                                         $16     
         35        IS_NOT_IDENTICAL                                         $16, 0
         36      > JMPZ                                                     ~17, ->39
   21    37    >   ASSIGN                                                   !2, 1
         38      > JMP                                                      ->40
   25    39    >   ASSIGN                                                   !2, 2
   28    40    >   ECHO                                                     !2
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.57 ms | 1400 KiB | 21 Q