3v4l.org

run code in 300+ PHP versions simultaneously
<?php // taken from walf, http://www.php.net/manual/en/function.hex2bin.php // this function comes with PHP >= 5.4.0 if (!function_exists('hex2bin')) { function hex2bin($data) { static $old; if ($old === null) { $old = version_compare(PHP_VERSION, '5.2', '<'); } $isobj = false; if (is_scalar($data) || (($isobj = is_object($data)) && method_exists($data, '__toString'))) { if ($isobj && $old) { ob_start(); echo $data; $data = ob_get_clean(); } else { $data = (string) $data; } } else { trigger_error(__FUNCTION__.'() expects parameter 1 to be string, ' . gettype($data) . ' given', E_USER_WARNING); return; //null in this case } $len = strlen($data); if ($len % 2) { trigger_error(__FUNCTION__.'(): Hexadecimal input string must have an even length', E_USER_WARNING); return false; } if (strspn($data, '0123456789abcdefABCDEF') != $len) { trigger_error(__FUNCTION__.'(): Input string must be hexadecimal string', E_USER_WARNING); return false; } return pack('H*', $data); } } function heutf8($str, $ent_constant = ENT_COMPAT) { return htmlentities($str, $ent_constant, 'UTF-8'); } $str = hex2bin('c0206c61206d6169736f6e'); print(heutf8($str)); ?>
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 = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/BJEVR
function name:  (null)
number of ops:  15
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'hex2bin'
          2        DO_ICALL                                         $1      
          3        BOOL_NOT                                         ~2      $1
          4      > JMPZ                                                     ~2, ->6
    6     5    >   DECLARE_FUNCTION                                         'hex2bin'
   43     6    >   INIT_FCALL                                               'hex2bin'
          7        SEND_VAL                                                 'c0206c61206d6169736f6e'
          8        DO_ICALL                                         $3      
          9        ASSIGN                                                   !0, $3
   44    10        INIT_FCALL                                               'heutf8'
         11        SEND_VAR                                                 !0
         12        DO_FCALL                                      0  $5      
         13        ECHO                                                     $5
   46    14      > RETURN                                                   1

Function %00hex2bin%2Fin%2FBJEVR%3A6%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 36
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 33
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 53
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 64
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
Branch analysis from position: 25
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 22
Branch analysis from position: 10
filename:       /in/BJEVR
function name:  hex2bin
number of ops:  70
compiled vars:  !0 = $data, !1 = $old, !2 = $isobj, !3 = $len
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        BIND_STATIC                                              !1
    8     2        TYPE_CHECK                                    2          !1
          3      > JMPZ                                                     ~4, ->10
    9     4    >   INIT_FCALL                                               'version_compare'
          5        SEND_VAL                                                 '8.0.0'
          6        SEND_VAL                                                 '5.2'
          7        SEND_VAL                                                 '%3C'
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !1, $5
   11    10    >   ASSIGN                                                   !2, <false>
   12    11        TYPE_CHECK                                  124  ~8      !0
         12      > JMPNZ_EX                                         ~8      ~8, ->22
         13    >   TYPE_CHECK                                  256  ~9      !0
         14        ASSIGN                                           ~10     !2, ~9
         15      > JMPZ_EX                                          ~10     ~10, ->21
         16    >   INIT_FCALL                                               'method_exists'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 '__toString'
         19        DO_ICALL                                         $11     
         20        BOOL                                             ~10     $11
         21    >   BOOL                                             ~8      ~10
         22    > > JMPZ                                                     ~8, ->36
   13    23    > > JMPZ_EX                                          ~12     !2, ->25
         24    >   BOOL                                             ~12     !1
         25    > > JMPZ                                                     ~12, ->33
   14    26    >   INIT_FCALL                                               'ob_start'
         27        DO_ICALL                                                 
   15    28        ECHO                                                     !0
   16    29        INIT_FCALL                                               'ob_get_clean'
         30        DO_ICALL                                         $14     
         31        ASSIGN                                                   !0, $14
         32      > JMP                                                      ->35
   19    33    >   CAST                                          6  ~16     !0
         34        ASSIGN                                                   !0, ~16
         35    > > JMP                                                      ->44
   23    36    >   INIT_FCALL                                               'trigger_error'
         37        GET_TYPE                                         ~18     !0
         38        CONCAT                                           ~19     'hex2bin%28%29+expects+parameter+1+to+be+string%2C+', ~18
         39        CONCAT                                           ~20     ~19, '+given'
         40        SEND_VAL                                                 ~20
         41        SEND_VAL                                                 512
         42        DO_ICALL                                                 
   24    43      > RETURN                                                   null
   26    44    >   STRLEN                                           ~22     !0
         45        ASSIGN                                                   !3, ~22
   27    46        MOD                                              ~24     !3, 2
         47      > JMPZ                                                     ~24, ->53
   28    48    >   INIT_FCALL                                               'trigger_error'
         49        SEND_VAL                                                 'hex2bin%28%29%3A+Hexadecimal+input+string+must+have+an+even+length'
         50        SEND_VAL                                                 512
         51        DO_ICALL                                                 
   29    52      > RETURN                                                   <false>
   31    53    >   INIT_FCALL                                               'strspn'
         54        SEND_VAR                                                 !0
         55        SEND_VAL                                                 '0123456789abcdefABCDEF'
         56        DO_ICALL                                         $26     
         57        IS_NOT_EQUAL                                             !3, $26
         58      > JMPZ                                                     ~27, ->64
   32    59    >   INIT_FCALL                                               'trigger_error'
         60        SEND_VAL                                                 'hex2bin%28%29%3A+Input+string+must+be+hexadecimal+string'
         61        SEND_VAL                                                 512
         62        DO_ICALL                                                 
   33    63      > RETURN                                                   <false>
   35    64    >   INIT_FCALL                                               'pack'
         65        SEND_VAL                                                 'H%2A'
         66        SEND_VAR                                                 !0
         67        DO_ICALL                                         $29     
         68      > RETURN                                                   $29
   36    69*     > RETURN                                                   null

End of function %00hex2bin%2Fin%2FBJEVR%3A6%240

Function heutf8:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BJEVR
function name:  heutf8
number of ops:  9
compiled vars:  !0 = $str, !1 = $ent_constant
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
   40     2        INIT_FCALL                                               'htmlentities'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_VAL                                                 'UTF-8'
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
   41     8*     > RETURN                                                   null

End of function heutf8

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.62 ms | 1407 KiB | 34 Q