3v4l.org

run code in 300+ PHP versions simultaneously
<?php $var = 'test123456'; $hex = ''; for ($i=0; $i<strlen($var); $i++){ $ord = ord($var[$i]); $hexCode = dechex($ord); $hex .= substr('0'.$hexCode, -2); } $parts = str_split($hex,8); foreach($parts as $key=>$value){ $parts[$key] = str_pad($value, 8, "0", STR_PAD_RIGHT); $innerParts = str_split($parts[$key],2); $innerParts = array_reverse($innerParts); $parts[$key] = "0x".implode('',$innerParts); } print_r($parts); // 616e6e6f79696e67206d6f6e6b6579
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 4
Branch analysis from position: 23
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 57
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 57
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 4
Branch analysis from position: 23
Branch analysis from position: 4
filename:       /in/BNkCv
function name:  (null)
number of ops:  62
compiled vars:  !0 = $var, !1 = $hex, !2 = $i, !3 = $ord, !4 = $hexCode, !5 = $parts, !6 = $value, !7 = $key, !8 = $innerParts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'test123456'
    3     1        ASSIGN                                                   !1, ''
    4     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->20
    5     4    >   INIT_FCALL                                               'ord'
          5        FETCH_DIM_R                                      ~12     !0, !2
          6        SEND_VAL                                                 ~12
          7        DO_ICALL                                         $13     
          8        ASSIGN                                                   !3, $13
    6     9        INIT_FCALL                                               'dechex'
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $15     
         12        ASSIGN                                                   !4, $15
    7    13        INIT_FCALL                                               'substr'
         14        CONCAT                                           ~17     '0', !4
         15        SEND_VAL                                                 ~17
         16        SEND_VAL                                                 -2
         17        DO_ICALL                                         $18     
         18        ASSIGN_OP                                     8          !1, $18
    4    19        PRE_INC                                                  !2
         20    >   STRLEN                                           ~21     !0
         21        IS_SMALLER                                               !2, ~21
         22      > JMPNZ                                                    ~22, ->4
    9    23    >   INIT_FCALL                                               'str_split'
         24        SEND_VAR                                                 !1
         25        SEND_VAL                                                 8
         26        DO_ICALL                                         $23     
         27        ASSIGN                                                   !5, $23
   10    28      > FE_RESET_R                                       $25     !5, ->57
         29    > > FE_FETCH_R                                       ~26     $25, !6, ->57
         30    >   ASSIGN                                                   !7, ~26
   11    31        INIT_FCALL                                               'str_pad'
         32        SEND_VAR                                                 !6
         33        SEND_VAL                                                 8
         34        SEND_VAL                                                 '0'
         35        SEND_VAL                                                 1
         36        DO_ICALL                                         $29     
         37        ASSIGN_DIM                                               !5, !7
         38        OP_DATA                                                  $29
   12    39        INIT_FCALL                                               'str_split'
         40        FETCH_DIM_R                                      ~30     !5, !7
         41        SEND_VAL                                                 ~30
         42        SEND_VAL                                                 2
         43        DO_ICALL                                         $31     
         44        ASSIGN                                                   !8, $31
   13    45        INIT_FCALL                                               'array_reverse'
         46        SEND_VAR                                                 !8
         47        DO_ICALL                                         $33     
         48        ASSIGN                                                   !8, $33
   14    49        INIT_FCALL                                               'implode'
         50        SEND_VAL                                                 ''
         51        SEND_VAR                                                 !8
         52        DO_ICALL                                         $36     
         53        CONCAT                                           ~37     '0x', $36
         54        ASSIGN_DIM                                               !5, !7
         55        OP_DATA                                                  ~37
   10    56      > JMP                                                      ->29
         57    >   FE_FREE                                                  $25
   16    58        INIT_FCALL                                               'print_r'
         59        SEND_VAR                                                 !5
         60        DO_ICALL                                                 
         61      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.05 ms | 1400 KiB | 29 Q