3v4l.org

run code in 500+ PHP versions simultaneously
<?php $word = 'base64_decode'; echo 'bin2hex: ' . PHP_EOL; echo implode(array_map(function($char) { return '\x' . bin2hex($char); }, str_split($word))) . PHP_EOL . PHP_EOL; echo 'unpack: ' . PHP_EOL; echo implode(array_map(function($char) { return '\x' . implode(unpack('H*', $char)); }, str_split($word))) . PHP_EOL . PHP_EOL; echo 'sprintf: ' . PHP_EOL; echo $encoded = implode(array_map(function($char) { return sprintf('\x%02X', ord($char)); }, (array) str_split($word))); echo PHP_EOL . PHP_EOL; echo '-------------------------' . PHP_EOL . PHP_EOL . 'decoded:' . PHP_EOL; $hexadecimal = str_replace('\x', '', $encoded); echo 'hex2bin:' . PHP_EOL; echo hex2bin($hexadecimal) . PHP_EOL . PHP_EOL; echo 'pack:' . PHP_EOL; echo pack('H*', $hexadecimal) . PHP_EOL . PHP_EOL; echo 'sscanf + vprintf' . PHP_EOL; vprintf(str_repeat('%c', count($f = sscanf($hexadecimal, str_repeat('%02X', substr_count($encoded , '\x'))))), $f);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ai3HZ
function name:  (null)
number of ops:  84
compiled vars:  !0 = $word, !1 = $encoded, !2 = $hexadecimal, !3 = $f
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'base64_decode'
    5     1        ECHO                                                         'bin2hex%3A+%0A'
    6     2        INIT_FCALL                                                   'array_map'
          3        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
    8     4        SEND_VAL                                                     ~5
          5        INIT_FCALL                                                   'str_split'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                             $6      
          8        SEND_VAR                                                     $6
    6     9        DO_ICALL                                             $7      
         10        FRAMELESS_ICALL_1                implode             ~8      $7
    8    11        CONCAT                                               ~9      ~8, '%0A'
         12        CONCAT                                               ~10     ~9, '%0A'
         13        ECHO                                                         ~10
   10    14        ECHO                                                         'unpack%3A+%0A'
   11    15        INIT_FCALL                                                   'array_map'
         16        DECLARE_LAMBDA_FUNCTION                              ~11     [1]
   13    17        SEND_VAL                                                     ~11
         18        INIT_FCALL                                                   'str_split'
         19        SEND_VAR                                                     !0
         20        DO_ICALL                                             $12     
         21        SEND_VAR                                                     $12
   11    22        DO_ICALL                                             $13     
         23        FRAMELESS_ICALL_1                implode             ~14     $13
   13    24        CONCAT                                               ~15     ~14, '%0A'
         25        CONCAT                                               ~16     ~15, '%0A'
         26        ECHO                                                         ~16
   15    27        ECHO                                                         'sprintf%3A+%0A'
   16    28        INIT_FCALL                                                   'array_map'
         29        DECLARE_LAMBDA_FUNCTION                              ~17     [2]
   18    30        SEND_VAL                                                     ~17
         31        INIT_FCALL                                                   'str_split'
         32        SEND_VAR                                                     !0
         33        DO_ICALL                                             $18     
         34        CAST                                              7  ~19     $18
         35        SEND_VAL                                                     ~19
   16    36        DO_ICALL                                             $20     
         37        FRAMELESS_ICALL_1                implode             ~21     $20
         38        ASSIGN                                               ~22     !1, ~21
         39        ECHO                                                         ~22
   19    40        ECHO                                                         '%0A%0A'
   21    41        ECHO                                                         '-------------------------%0A%0Adecoded%3A%0A'
   22    42        FRAMELESS_ICALL_3                str_replace         ~23     '%5Cx', ''
         43        OP_DATA                                                      !1
         44        ASSIGN                                                       !2, ~23
   24    45        ECHO                                                         'hex2bin%3A%0A'
   25    46        INIT_FCALL                                                   'hex2bin'
         47        SEND_VAR                                                     !2
         48        DO_ICALL                                             $25     
         49        CONCAT                                               ~26     $25, '%0A'
         50        CONCAT                                               ~27     ~26, '%0A'
         51        ECHO                                                         ~27
   27    52        ECHO                                                         'pack%3A%0A'
   28    53        INIT_FCALL                                                   'pack'
         54        SEND_VAL                                                     'H%2A'
         55        SEND_VAR                                                     !2
         56        DO_ICALL                                             $28     
         57        CONCAT                                               ~29     $28, '%0A'
         58        CONCAT                                               ~30     ~29, '%0A'
         59        ECHO                                                         ~30
   30    60        ECHO                                                         'sscanf+%2B+vprintf%0A'
   31    61        INIT_FCALL                                                   'vprintf'
         62        INIT_FCALL                                                   'str_repeat'
         63        SEND_VAL                                                     '%25c'
         64        INIT_FCALL                                                   'sscanf'
         65        SEND_VAR                                                     !2
         66        INIT_FCALL                                                   'str_repeat'
         67        SEND_VAL                                                     '%2502X'
         68        INIT_FCALL                                                   'substr_count'
         69        SEND_VAR                                                     !1
         70        SEND_VAL                                                     '%5Cx'
         71        DO_ICALL                                             $31     
         72        SEND_VAR                                                     $31
         73        DO_ICALL                                             $32     
         74        SEND_VAR                                                     $32
         75        DO_ICALL                                             $33     
         76        ASSIGN                                               ~34     !3, $33
         77        COUNT                                                ~35     ~34
         78        SEND_VAL                                                     ~35
         79        DO_ICALL                                             $36     
         80        SEND_VAR                                                     $36
         81        SEND_VAR                                                     !3
         82        DO_ICALL                                                     
         83      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ai3HZ
function name:  {closure:/in/Ai3HZ:6}
number of ops:  7
compiled vars:  !0 = $char
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        INIT_FCALL                                                   'bin2hex'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4        CONCAT                                               ~2      '%5Cx', $1
          5      > RETURN                                                       ~2
    8     6*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ai3HZ
function name:  {closure:/in/Ai3HZ:11}
number of ops:  9
compiled vars:  !0 = $char
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
   12     1        INIT_FCALL                                                   'unpack'
          2        SEND_VAL                                                     'H%2A'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $1      
          5        FRAMELESS_ICALL_1                implode             ~2      $1
          6        CONCAT                                               ~3      '%5Cx', ~2
          7      > RETURN                                                       ~3
   13     8*     > RETURN                                                       null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ai3HZ
function name:  {closure:/in/Ai3HZ:16}
number of ops:  10
compiled vars:  !0 = $char
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
   17     1        INIT_FCALL                                                   'sprintf'
          2        SEND_VAL                                                     '%5Cx%2502X'
          3        INIT_FCALL                                                   'ord'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $1      
          6        SEND_VAR                                                     $1
          7        DO_ICALL                                             $2      
          8      > RETURN                                                       $2
   18     9*     > RETURN                                                       null

End of Dynamic Function 2

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
192.84 ms | 1973 KiB | 25 Q