3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isBinary(string $data): bool { return ! mb_check_encoding($data, 'UTF-8'); } echo "Text:\n"; var_dump(isBinary('')); var_dump(isBinary('Some Content')); var_dump(isBinary('Sóme Cotént')); var_dump(isBinary('这是一些内容')); var_dump(isBinary('Αυτό είναι κάποιο περιεχόμενο')); var_dump(isBinary(' תוכן מסוים')); var_dump(isBinary('Это некоторое содержимое')); var_dump(isBinary('هذا بعض المحتوى')); var_dump(isBinary('هこれは一部のコンテンツです')); echo "Binary:\n"; var_dump(isBinary("\xC3\x28")); var_dump(isBinary("\xE0\xA0")); var_dump(isBinary("\xF0\x90\0")); var_dump(isBinary("\xF5\x80\x80\x80")); var_dump(isBinary("\xF4\x90\x80\x80"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FF2sb
function name:  (null)
number of ops:  87
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'Text%3A%0A'
    9     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'isbinary'
          3        SEND_VAL                                                 ''
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   10     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'isbinary'
          9        SEND_VAL                                                 'Some+Content'
         10        DO_FCALL                                      0  $2      
         11        SEND_VAR                                                 $2
         12        DO_ICALL                                                 
   11    13        INIT_FCALL                                               'var_dump'
         14        INIT_FCALL                                               'isbinary'
         15        SEND_VAL                                                 'S%C3%B3me+Cot%C3%A9nt'
         16        DO_FCALL                                      0  $4      
         17        SEND_VAR                                                 $4
         18        DO_ICALL                                                 
   12    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'isbinary'
         21        SEND_VAL                                                 '%E8%BF%99%E6%98%AF%E4%B8%80%E4%BA%9B%E5%86%85%E5%AE%B9'
         22        DO_FCALL                                      0  $6      
         23        SEND_VAR                                                 $6
         24        DO_ICALL                                                 
   13    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'isbinary'
         27        SEND_VAL                                                 '%CE%91%CF%85%CF%84%CF%8C+%CE%B5%CE%AF%CE%BD%CE%B1%CE%B9+%CE%BA%CE%AC%CF%80%CE%BF%CE%B9%CE%BF+%CF%80%CE%B5%CF%81%CE%B9%CE%B5%CF%87%CF%8C%CE%BC%CE%B5%CE%BD%CE%BF'
         28        DO_FCALL                                      0  $8      
         29        SEND_VAR                                                 $8
         30        DO_ICALL                                                 
   14    31        INIT_FCALL                                               'var_dump'
         32        INIT_FCALL                                               'isbinary'
         33        SEND_VAL                                                 '+%D7%AA%D7%95%D7%9B%D7%9F+%D7%9E%D7%A1%D7%95%D7%99%D7%9D'
         34        DO_FCALL                                      0  $10     
         35        SEND_VAR                                                 $10
         36        DO_ICALL                                                 
   15    37        INIT_FCALL                                               'var_dump'
         38        INIT_FCALL                                               'isbinary'
         39        SEND_VAL                                                 '%D0%AD%D1%82%D0%BE+%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D0%BE%D0%B5+%D1%81%D0%BE%D0%B4%D0%B5%D1%80%D0%B6%D0%B8%D0%BC%D0%BE%D0%B5'
         40        DO_FCALL                                      0  $12     
         41        SEND_VAR                                                 $12
         42        DO_ICALL                                                 
   16    43        INIT_FCALL                                               'var_dump'
         44        INIT_FCALL                                               'isbinary'
         45        SEND_VAL                                                 '%D9%87%D8%B0%D8%A7+%D8%A8%D8%B9%D8%B6+%D8%A7%D9%84%D9%85%D8%AD%D8%AA%D9%88%D9%89'
         46        DO_FCALL                                      0  $14     
         47        SEND_VAR                                                 $14
         48        DO_ICALL                                                 
   17    49        INIT_FCALL                                               'var_dump'
         50        INIT_FCALL                                               'isbinary'
         51        SEND_VAL                                                 '%D9%87%E3%81%93%E3%82%8C%E3%81%AF%E4%B8%80%E9%83%A8%E3%81%AE%E3%82%B3%E3%83%B3%E3%83%86%E3%83%B3%E3%83%84%E3%81%A7%E3%81%99'
         52        DO_FCALL                                      0  $16     
         53        SEND_VAR                                                 $16
         54        DO_ICALL                                                 
   19    55        ECHO                                                     'Binary%3A%0A'
   20    56        INIT_FCALL                                               'var_dump'
         57        INIT_FCALL                                               'isbinary'
         58        SEND_VAL                                                 '%C3%28'
         59        DO_FCALL                                      0  $18     
         60        SEND_VAR                                                 $18
         61        DO_ICALL                                                 
   21    62        INIT_FCALL                                               'var_dump'
         63        INIT_FCALL                                               'isbinary'
         64        SEND_VAL                                                 '%E0%A0'
         65        DO_FCALL                                      0  $20     
         66        SEND_VAR                                                 $20
         67        DO_ICALL                                                 
   22    68        INIT_FCALL                                               'var_dump'
         69        INIT_FCALL                                               'isbinary'
         70        SEND_VAL                                                 '%F0%90%00'
         71        DO_FCALL                                      0  $22     
         72        SEND_VAR                                                 $22
         73        DO_ICALL                                                 
   23    74        INIT_FCALL                                               'var_dump'
         75        INIT_FCALL                                               'isbinary'
         76        SEND_VAL                                                 '%F5%80%80%80'
         77        DO_FCALL                                      0  $24     
         78        SEND_VAR                                                 $24
         79        DO_ICALL                                                 
   24    80        INIT_FCALL                                               'var_dump'
         81        INIT_FCALL                                               'isbinary'
         82        SEND_VAL                                                 '%F4%90%80%80'
         83        DO_FCALL                                      0  $26     
         84        SEND_VAR                                                 $26
         85        DO_ICALL                                                 
         86      > RETURN                                                   1

Function isbinary:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FF2sb
function name:  isBinary
number of ops:  10
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'mb_check_encoding'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'UTF-8'
          4        DO_ICALL                                         $1      
          5        BOOL_NOT                                         ~2      $1
          6        VERIFY_RETURN_TYPE                                       ~2
          7      > RETURN                                                   ~2
    6     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null

End of function isbinary

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
216.48 ms | 1017 KiB | 29 Q