3v4l.org

run code in 300+ PHP versions simultaneously
<?php $examples = array( 'Valid ASCII' => "a", 'Valid 2 Octet Sequence' => "\xc3\xb1", 'Invalid 2 Octet Sequence' => "\xc3\x28", 'Invalid Sequence Identifier' => "\xa0\xa1", 'Valid 3 Octet Sequence' => "\xe2\x82\xa1", 'Invalid 3 Octet Sequence (in 2nd Octet)' => "\xe2\x28\xa1", 'Invalid 3 Octet Sequence (in 3rd Octet)' => "\xe2\x82\x28", 'Valid 4 Octet Sequence' => "\xf0\x90\x8c\xbc", 'Invalid 4 Octet Sequence (in 2nd Octet)' => "\xf0\x28\x8c\xbc", 'Invalid 4 Octet Sequence (in 3rd Octet)' => "\xf0\x90\x28\xbc", 'Invalid 4 Octet Sequence (in 4th Octet)' => "\xf0\x28\x8c\x28", 'Valid 5 Octet Sequence (but not Unicode!)' => "\xf8\xa1\xa1\xa1\xa1", 'Valid 6 Octet Sequence (but not Unicode!)' => "\xfc\xa1\xa1\xa1\xa1\xa1", ); mb_substitute_character(0xFFFD); foreach ($examples as $k => $v) { echo "{$k}\n"; echo mb_convert_encoding($v, 'UTF-8', 'UTF-8'); echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 18
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/PkO6p
function name:  (null)
number of ops:  20
compiled vars:  !0 = $examples, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'mb_substitute_character'
          2        SEND_VAL                                                 65533
          3        DO_ICALL                                                 
   22     4      > FE_RESET_R                                       $5      !0, ->18
          5    > > FE_FETCH_R                                       ~6      $5, !1, ->18
          6    >   ASSIGN                                                   !2, ~6
   24     7        NOP                                                      
          8        FAST_CONCAT                                      ~8      !2, '%0A'
          9        ECHO                                                     ~8
   25    10        INIT_FCALL                                               'mb_convert_encoding'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 'UTF-8'
         13        SEND_VAL                                                 'UTF-8'
         14        DO_ICALL                                         $9      
         15        ECHO                                                     $9
   26    16        ECHO                                                     '%0A'
   22    17      > JMP                                                      ->5
         18    >   FE_FREE                                                  $5
   28    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.38 ms | 1395 KiB | 17 Q