3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($input) { $output = htmlspecialchars($input, ENT_QUOTES, 'UTF-8'); $code = str_replace('%', '\\x', rawurlencode($input)); if (validate_utf8($input)) { echo "【{$output}】({$code}) は有効なUTF-8シーケンスです。\n"; } else { echo "({$code}) は無効なUTF-8シーケンスです。\n"; } } test("☝( ◠‿◠ )☝"); test("ゔ〲〰"); test("\x0a\x92\xff"); // てきとー test("\xef\xbb\xbf"); // BOMだっけ test(""); // 空文字列 echo "\n"; test("\x2f"); // スラッシュ(1バイト) test("\xc0\xaf"); // スラッシュ(冗長2バイト) test("\xe0\x80\xaf"); // スラッシュ(冗長3バイト) test("\xf0\x80\x80\xaf"); // スラッシュ(冗長4バイト)
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4NNW0
function name:  (null)
number of ops:  29
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'test'
          1        SEND_VAL                                                 '%E2%98%9D%28+%E2%97%A0%E2%80%BF%E2%97%A0+%29%E2%98%9D'
          2        DO_FCALL                                      0          
   17     3        INIT_FCALL                                               'test'
          4        SEND_VAL                                                 '%E3%82%94%E3%80%B2%E3%80%B0'
          5        DO_FCALL                                      0          
   18     6        INIT_FCALL                                               'test'
          7        SEND_VAL                                                 '%0A%92%FF'
          8        DO_FCALL                                      0          
   19     9        INIT_FCALL                                               'test'
         10        SEND_VAL                                                 '%EF%BB%BF'
         11        DO_FCALL                                      0          
   20    12        INIT_FCALL                                               'test'
         13        SEND_VAL                                                 ''
         14        DO_FCALL                                      0          
   22    15        ECHO                                                     '%0A'
   24    16        INIT_FCALL                                               'test'
         17        SEND_VAL                                                 '%2F'
         18        DO_FCALL                                      0          
   25    19        INIT_FCALL                                               'test'
         20        SEND_VAL                                                 '%C0%AF'
         21        DO_FCALL                                      0          
   26    22        INIT_FCALL                                               'test'
         23        SEND_VAL                                                 '%E0%80%AF'
         24        DO_FCALL                                      0          
   27    25        INIT_FCALL                                               'test'
         26        SEND_VAL                                                 '%F0%80%80%AF'
         27        DO_FCALL                                      0          
         28      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4NNW0
function name:  test
number of ops:  32
compiled vars:  !0 = $input, !1 = $output, !2 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'htmlspecialchars'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 3
          4        SEND_VAL                                                 'UTF-8'
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
    6     7        INIT_FCALL                                               'str_replace'
          8        SEND_VAL                                                 '%25'
          9        SEND_VAL                                                 '%5Cx'
         10        INIT_FCALL                                               'rawurlencode'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $5      
         13        SEND_VAR                                                 $5
         14        DO_ICALL                                         $6      
         15        ASSIGN                                                   !2, $6
    8    16        INIT_FCALL_BY_NAME                                       'validate_utf8'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $8      
         19      > JMPZ                                                     $8, ->27
    9    20    >   ROPE_INIT                                     5  ~10     '%E3%80%90'
         21        ROPE_ADD                                      1  ~10     ~10, !1
         22        ROPE_ADD                                      2  ~10     ~10, '%E3%80%91%28'
         23        ROPE_ADD                                      3  ~10     ~10, !2
         24        ROPE_END                                      4  ~9      ~10, '%29+%E3%81%AF%E6%9C%89%E5%8A%B9%E3%81%AAUTF-8%E3%82%B7%E3%83%BC%E3%82%B1%E3%83%B3%E3%82%B9%E3%81%A7%E3%81%99%E3%80%82%0A'
         25        ECHO                                                     ~9
         26      > JMP                                                      ->31
   11    27    >   ROPE_INIT                                     3  ~14     '%28'
         28        ROPE_ADD                                      1  ~14     ~14, !2
         29        ROPE_END                                      2  ~13     ~14, '%29+%E3%81%AF%E7%84%A1%E5%8A%B9%E3%81%AAUTF-8%E3%82%B7%E3%83%BC%E3%82%B1%E3%83%B3%E3%82%B9%E3%81%A7%E3%81%99%E3%80%82%0A'
         30        ECHO                                                     ~13
   14    31    > > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.07 ms | 1402 KiB | 28 Q