3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(! function_exists('str_split')) { function str_split($text, $split = 1) { $array = array(); for ($i = 0; $i < strlen($text);) { $array[] = substr($text, $i, $split); $i += $split; } return $array; } } function hex_dump($data, $newline = "\n") { static $from = ''; static $to = ''; static $idxOffset = 8; static $width = 16; # number of bytes per line static $pad = '.'; # padding for non-visible characters static $hexPad = '00'; static $repeatHeadline = 5; if ($from === '') { for ($i = 0; $i <= 0xFF; ++$i) { $from .= chr($i); $to .= ($i >= 0x20 && $i <= 0x7E) ? chr($i) : $pad; } } $text = true; echo ($text) ? '' : '<pre>'; $head = str_repeat(' ', $idxOffset).' | '. implode(' ', array_map( create_function( '$str', 'return sprintf("%2X", $str);' ), range(0, $width - 1) )).' | '.(str_pad('', $width, '0123456789abcdef')).$newline; $separator = str_repeat('-', $idxOffset + 1).'+'.str_repeat('-', 3 * $width + 1).'+'. str_repeat('-', $width + 1).$newline; echo $head.$separator; $hex = str_split(bin2hex($data), $width * 2); $chars = str_split(strtr($data, $from, $to), $width); $hexLineBase = array_fill(0, $width, $hexPad); $offset = $c = 0; foreach ($hex as $i => $line) { $hexLine = str_split($line, 2) + $hexLineBase; $strLine = $chars[$i].str_repeat($pad, $width - strlen($chars[$i])); $line = sprintf('%'.$idxOffset.'X', $offset) . ' | ' . implode(' ', $hexLine) . ' | ' . $strLine . $newline; echo ($text) ? $line : htmlspecialchars($line); $offset += $width; if (++$c == $repeatHeadline) { echo $separator.$head.$separator; $c = 0; } } echo ($text) ? $newline.$newline : '<pre>'; } hex_dump(' \t\n\r\x0B'); hex_dump(" \t\n\r\x0B");
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/AlFrp
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'str_split'
          2        DO_ICALL                                         $0      
          3        BOOL_NOT                                         ~1      $0
          4      > JMPZ                                                     ~1, ->6
    5     5    >   DECLARE_FUNCTION                                         'str_split'
   78     6    >   INIT_FCALL                                               'hex_dump'
          7        SEND_VAL                                                 '+%5Ct%5Cn%5Cr%5Cx0B'
          8        DO_FCALL                                      0          
   79     9        INIT_FCALL                                               'hex_dump'
         10        SEND_VAL                                                 '+%09%0A%0D%0B'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function %00str_split%2Fin%2FAlFrp%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 5
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 5
Branch analysis from position: 16
Branch analysis from position: 5
filename:       /in/AlFrp
function name:  str_split
number of ops:  18
compiled vars:  !0 = $text, !1 = $split, !2 = $array, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      1
    7     2        ASSIGN                                                   !2, <array>
    9     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->13
   11     5    >   INIT_FCALL                                               'substr'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !3
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $7      
         10        ASSIGN_DIM                                               !2
         11        OP_DATA                                                  $7
   12    12        ASSIGN_OP                                     1          !3, !1
    9    13    >   STRLEN                                           ~9      !0
         14        IS_SMALLER                                               !3, ~9
         15      > JMPNZ                                                    ~10, ->5
   15    16    > > RETURN                                                   !2
   16    17*     > RETURN                                                   null

End of function %00str_split%2Fin%2FAlFrp%3A5%240

Function hex_dump:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 32
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 13
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 77) Position 1 = 122, Position 2 = 173
Branch analysis from position: 122
2 jumps found. (Code = 78) Position 1 = 123, Position 2 = 173
Branch analysis from position: 123
2 jumps found. (Code = 43) Position 1 = 157, Position 2 = 159
Branch analysis from position: 157
1 jumps found. (Code = 42) Position 1 = 163
Branch analysis from position: 163
2 jumps found. (Code = 43) Position 1 = 168, Position 2 = 172
Branch analysis from position: 168
1 jumps found. (Code = 42) Position 1 = 122
Branch analysis from position: 122
Branch analysis from position: 172
Branch analysis from position: 159
2 jumps found. (Code = 43) Position 1 = 168, Position 2 = 172
Branch analysis from position: 168
Branch analysis from position: 172
Branch analysis from position: 173
2 jumps found. (Code = 43) Position 1 = 175, Position 2 = 178
Branch analysis from position: 175
1 jumps found. (Code = 42) Position 1 = 179
Branch analysis from position: 179
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 178
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 173
Branch analysis from position: 36
2 jumps found. (Code = 77) Position 1 = 122, Position 2 = 173
Branch analysis from position: 122
Branch analysis from position: 173
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 13
Branch analysis from position: 32
Branch analysis from position: 13
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 13
Branch analysis from position: 32
Branch analysis from position: 13
Branch analysis from position: 21
Branch analysis from position: 32
filename:       /in/AlFrp
function name:  hex_dump
number of ops:  181
compiled vars:  !0 = $data, !1 = $newline, !2 = $from, !3 = $to, !4 = $idxOffset, !5 = $width, !6 = $pad, !7 = $hexPad, !8 = $repeatHeadline, !9 = $i, !10 = $text, !11 = $head, !12 = $separator, !13 = $hex, !14 = $chars, !15 = $hexLineBase, !16 = $offset, !17 = $c, !18 = $line, !19 = $hexLine, !20 = $strLine
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      '%0A'
   20     2        BIND_STATIC                                              !2
   21     3        BIND_STATIC                                              !3
   23     4        BIND_STATIC                                              !4
   24     5        BIND_STATIC                                              !5
   26     6        BIND_STATIC                                              !6
   28     7        BIND_STATIC                                              !7
   30     8        BIND_STATIC                                              !8
   32     9        IS_IDENTICAL                                             !2, ''
         10      > JMPZ                                                     ~21, ->32
   33    11    >   ASSIGN                                                   !9, 0
         12      > JMP                                                      ->30
   34    13    >   INIT_FCALL                                               'chr'
         14        SEND_VAR                                                 !9
         15        DO_ICALL                                         $23     
         16        ASSIGN_OP                                     8          !2, $23
   35    17        IS_SMALLER_OR_EQUAL                              ~25     32, !9
         18      > JMPZ_EX                                          ~25     ~25, ->21
         19    >   IS_SMALLER_OR_EQUAL                              ~26     !9, 126
         20        BOOL                                             ~25     ~26
         21    > > JMPZ                                                     ~25, ->27
         22    >   INIT_FCALL                                               'chr'
         23        SEND_VAR                                                 !9
         24        DO_ICALL                                         $27     
         25        QM_ASSIGN                                        ~28     $27
         26      > JMP                                                      ->28
         27    >   QM_ASSIGN                                        ~28     !6
         28    >   ASSIGN_OP                                     8          !3, ~28
   33    29        PRE_INC                                                  !9
         30    >   IS_SMALLER_OR_EQUAL                                      !9, 255
         31      > JMPNZ                                                    ~31, ->13
   39    32    >   ASSIGN                                                   !10, <true>
   41    33      > JMPZ                                                     !10, ->36
         34    >   QM_ASSIGN                                        ~33     ''
         35      > JMP                                                      ->37
         36    >   QM_ASSIGN                                        ~33     '%3Cpre%3E'
         37    >   ECHO                                                     ~33
   43    38        INIT_FCALL                                               'str_repeat'
         39        SEND_VAL                                                 '+'
         40        SEND_VAR                                                 !4
         41        DO_ICALL                                         $34     
         42        CONCAT                                           ~35     $34, '+%7C+'
   44    43        INIT_FCALL                                               'implode'
         44        SEND_VAL                                                 '+'
         45        INIT_FCALL                                               'array_map'
   45    46        INIT_FCALL_BY_NAME                                       'create_function'
   46    47        SEND_VAL_EX                                              '%24str'
   47    48        SEND_VAL_EX                                              'return+sprintf%28%22%252X%22%2C+%24str%29%3B'
         49        DO_FCALL                                      0  $36     
         50        SEND_VAR                                                 $36
   49    51        INIT_FCALL                                               'range'
         52        SEND_VAL                                                 0
         53        SUB                                              ~37     !5, 1
         54        SEND_VAL                                                 ~37
         55        DO_ICALL                                         $38     
         56        SEND_VAR                                                 $38
         57        DO_ICALL                                         $39     
         58        SEND_VAR                                                 $39
         59        DO_ICALL                                         $40     
         60        CONCAT                                           ~41     ~35, $40
   50    61        CONCAT                                           ~42     ~41, '+%7C+'
         62        INIT_FCALL                                               'str_pad'
         63        SEND_VAL                                                 ''
         64        SEND_VAR                                                 !5
         65        SEND_VAL                                                 '0123456789abcdef'
         66        DO_ICALL                                         $43     
         67        CONCAT                                           ~44     ~42, $43
         68        CONCAT                                           ~45     ~44, !1
   43    69        ASSIGN                                                   !11, ~45
   51    70        INIT_FCALL                                               'str_repeat'
         71        SEND_VAL                                                 '-'
         72        ADD                                              ~47     !4, 1
         73        SEND_VAL                                                 ~47
         74        DO_ICALL                                         $48     
         75        CONCAT                                           ~49     $48, '%2B'
         76        INIT_FCALL                                               'str_repeat'
         77        SEND_VAL                                                 '-'
         78        MUL                                              ~50     !5, 3
         79        ADD                                              ~51     ~50, 1
         80        SEND_VAL                                                 ~51
         81        DO_ICALL                                         $52     
         82        CONCAT                                           ~53     ~49, $52
         83        CONCAT                                           ~54     ~53, '%2B'
   52    84        INIT_FCALL                                               'str_repeat'
         85        SEND_VAL                                                 '-'
         86        ADD                                              ~55     !5, 1
         87        SEND_VAL                                                 ~55
         88        DO_ICALL                                         $56     
         89        CONCAT                                           ~57     ~54, $56
         90        CONCAT                                           ~58     ~57, !1
   51    91        ASSIGN                                                   !12, ~58
   54    92        CONCAT                                           ~60     !11, !12
         93        ECHO                                                     ~60
   56    94        INIT_FCALL                                               'str_split'
         95        INIT_FCALL                                               'bin2hex'
         96        SEND_VAR                                                 !0
         97        DO_ICALL                                         $61     
         98        SEND_VAR                                                 $61
         99        MUL                                              ~62     !5, 2
        100        SEND_VAL                                                 ~62
        101        DO_ICALL                                         $63     
        102        ASSIGN                                                   !13, $63
   57   103        INIT_FCALL                                               'str_split'
        104        INIT_FCALL                                               'strtr'
        105        SEND_VAR                                                 !0
        106        SEND_VAR                                                 !2
        107        SEND_VAR                                                 !3
        108        DO_ICALL                                         $65     
        109        SEND_VAR                                                 $65
        110        SEND_VAR                                                 !5
        111        DO_ICALL                                         $66     
        112        ASSIGN                                                   !14, $66
   59   113        INIT_FCALL                                               'array_fill'
        114        SEND_VAL                                                 0
        115        SEND_VAR                                                 !5
        116        SEND_VAR                                                 !7
        117        DO_ICALL                                         $68     
        118        ASSIGN                                                   !15, $68
   61   119        ASSIGN                                           ~70     !17, 0
        120        ASSIGN                                                   !16, ~70
   62   121      > FE_RESET_R                                       $72     !13, ->173
        122    > > FE_FETCH_R                                       ~73     $72, !18, ->173
        123    >   ASSIGN                                                   !9, ~73
   63   124        INIT_FCALL                                               'str_split'
        125        SEND_VAR                                                 !18
        126        SEND_VAL                                                 2
        127        DO_ICALL                                         $75     
        128        ADD                                              ~76     $75, !15
        129        ASSIGN                                                   !19, ~76
   64   130        FETCH_DIM_R                                      ~78     !14, !9
        131        INIT_FCALL                                               'str_repeat'
        132        SEND_VAR                                                 !6
        133        FETCH_DIM_R                                      ~79     !14, !9
        134        STRLEN                                           ~80     ~79
        135        SUB                                              ~81     !5, ~80
        136        SEND_VAL                                                 ~81
        137        DO_ICALL                                         $82     
        138        CONCAT                                           ~83     ~78, $82
        139        ASSIGN                                                   !20, ~83
   66   140        INIT_FCALL                                               'sprintf'
        141        CONCAT                                           ~85     '%25', !4
        142        CONCAT                                           ~86     ~85, 'X'
        143        SEND_VAL                                                 ~86
        144        SEND_VAR                                                 !16
        145        DO_ICALL                                         $87     
        146        CONCAT                                           ~88     $87, '+%7C+'
        147        INIT_FCALL                                               'implode'
        148        SEND_VAL                                                 '+'
        149        SEND_VAR                                                 !19
        150        DO_ICALL                                         $89     
        151        CONCAT                                           ~90     ~88, $89
        152        CONCAT                                           ~91     ~90, '+%7C+'
        153        CONCAT                                           ~92     ~91, !20
        154        CONCAT                                           ~93     ~92, !1
        155        ASSIGN                                                   !18, ~93
   67   156      > JMPZ                                                     !10, ->159
        157    >   QM_ASSIGN                                        ~95     !18
        158      > JMP                                                      ->163
        159    >   INIT_FCALL                                               'htmlspecialchars'
        160        SEND_VAR                                                 !18
        161        DO_ICALL                                         $96     
        162        QM_ASSIGN                                        ~95     $96
        163    >   ECHO                                                     ~95
   68   164        ASSIGN_OP                                     1          !16, !5
   69   165        PRE_INC                                          ~98     !17
        166        IS_EQUAL                                                 !8, ~98
        167      > JMPZ                                                     ~99, ->172
   70   168    >   CONCAT                                           ~100    !12, !11
        169        CONCAT                                           ~101    ~100, !12
        170        ECHO                                                     ~101
   71   171        ASSIGN                                                   !17, 0
   62   172    > > JMP                                                      ->122
        173    >   FE_FREE                                                  $72
   75   174      > JMPZ                                                     !10, ->178
        175    >   CONCAT                                           ~103    !1, !1
        176        QM_ASSIGN                                        ~104    ~103
        177      > JMP                                                      ->179
        178    >   QM_ASSIGN                                        ~104    '%3Cpre%3E'
        179    >   ECHO                                                     ~104
   76   180      > RETURN                                                   null

End of function hex_dump

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.8 ms | 1419 KiB | 46 Q