3v4l.org

run code in 300+ PHP versions simultaneously
<?php $key = "66b3b0d86b56dfca4c8ca3e883700ac6"; $key = str2hex_array($key); print_r($key); function str2hex_array($str){ $str_arr = str_split(strToUpper($str), 2); //$str_hex = array(); $str_hex = ""; for ($i=0; $i < count($str_arr); $i++){ $ord1 = ord($str_arr[$i][0])-48; $ord2 = ord($str_arr[$i][1])-48; if ($ord1 > 16) $ord1 = $ord1 - 7; if ($ord2 > 16) $ord2 = $ord2 - 7; $str_hex[$i] = $ord1 * 16 + $ord2; } return $str_hex; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YoHIc
function name:  (null)
number of ops:  9
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '66b3b0d86b56dfca4c8ca3e883700ac6'
    3     1        INIT_FCALL_BY_NAME                                       'str2hex_array'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !0, $2
    4     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   18     8      > RETURN                                                   1

Function str2hex_array:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 12
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 12
Branch analysis from position: 42
Branch analysis from position: 12
Branch analysis from position: 34
Branch analysis from position: 30
filename:       /in/YoHIc
function name:  str2hex_array
number of ops:  44
compiled vars:  !0 = $str, !1 = $str_arr, !2 = $str_hex, !3 = $i, !4 = $ord1, !5 = $ord2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'str_split'
          2        INIT_FCALL                                               'strtoupper'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $6      
          5        SEND_VAR                                                 $6
          6        SEND_VAL                                                 2
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !1, $7
    9     9        ASSIGN                                                   !2, ''
   10    10        ASSIGN                                                   !3, 0
         11      > JMP                                                      ->39
   11    12    >   INIT_FCALL                                               'ord'
         13        FETCH_DIM_R                                      ~11     !1, !3
         14        FETCH_DIM_R                                      ~12     ~11, 0
         15        SEND_VAL                                                 ~12
         16        DO_ICALL                                         $13     
         17        SUB                                              ~14     $13, 48
         18        ASSIGN                                                   !4, ~14
   12    19        INIT_FCALL                                               'ord'
         20        FETCH_DIM_R                                      ~16     !1, !3
         21        FETCH_DIM_R                                      ~17     ~16, 1
         22        SEND_VAL                                                 ~17
         23        DO_ICALL                                         $18     
         24        SUB                                              ~19     $18, 48
         25        ASSIGN                                                   !5, ~19
   13    26        IS_SMALLER                                               16, !4
         27      > JMPZ                                                     ~21, ->30
         28    >   SUB                                              ~22     !4, 7
         29        ASSIGN                                                   !4, ~22
   14    30    >   IS_SMALLER                                               16, !5
         31      > JMPZ                                                     ~24, ->34
         32    >   SUB                                              ~25     !5, 7
         33        ASSIGN                                                   !5, ~25
   15    34    >   MUL                                              ~28     !4, 16
         35        ADD                                              ~29     ~28, !5
         36        ASSIGN_DIM                                               !2, !3
         37        OP_DATA                                                  ~29
   10    38        PRE_INC                                                  !3
         39    >   COUNT                                            ~31     !1
         40        IS_SMALLER                                               !3, ~31
         41      > JMPNZ                                                    ~32, ->12
   17    42    > > RETURN                                                   !2
   18    43*     > RETURN                                                   null

End of function str2hex_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.63 ms | 1006 KiB | 17 Q