3v4l.org

run code in 300+ PHP versions simultaneously
<?php print_r(hex2rgb("#AADDFF")); function hex2rgb($hex) { if (substr($hex,0,1)=="#"): $hex=substr($hex, 1); endif; if (strlen($hex)==3): $hex=$hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; elseif (strlen($hex)!=6): return false; else: $rgb=array(); $rgb[0] = hexdec(substr($hex,0,2)); // red $rgb[1] = hexdec(substr($hex,2,2)); // green $rgb[2] = hexdec(substr($hex,4,2)); // blue return $rgb; endif; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1Dkio
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL_BY_NAME                                       'hex2rgb'
          2        SEND_VAL_EX                                              '%23AADDFF'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   22     6      > RETURN                                                   1

Function hex2rgb:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 29
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/1Dkio
function name:  hex2rgb
number of ops:  67
compiled vars:  !0 = $hex, !1 = $rgb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'substr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 0
          4        SEND_VAL                                                 1
          5        DO_ICALL                                         $2      
          6        IS_EQUAL                                                 $2, '%23'
          7      > JMPZ                                                     ~3, ->13
    7     8    >   INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 1
         11        DO_ICALL                                         $4      
         12        ASSIGN                                                   !0, $4
    9    13    >   STRLEN                                           ~6      !0
         14        IS_EQUAL                                                 ~6, 3
         15      > JMPZ                                                     ~7, ->29
   10    16    >   FETCH_DIM_R                                      ~8      !0, 0
         17        FETCH_DIM_R                                      ~9      !0, 0
         18        CONCAT                                           ~10     ~8, ~9
         19        FETCH_DIM_R                                      ~11     !0, 1
         20        CONCAT                                           ~12     ~10, ~11
         21        FETCH_DIM_R                                      ~13     !0, 1
         22        CONCAT                                           ~14     ~12, ~13
         23        FETCH_DIM_R                                      ~15     !0, 2
         24        CONCAT                                           ~16     ~14, ~15
         25        FETCH_DIM_R                                      ~17     !0, 2
         26        CONCAT                                           ~18     ~16, ~17
         27        ASSIGN                                                   !0, ~18
         28      > JMP                                                      ->66
   11    29    >   STRLEN                                           ~20     !0
         30        IS_NOT_EQUAL                                             ~20, 6
         31      > JMPZ                                                     ~21, ->34
   12    32    > > RETURN                                                   <false>
         33*       JMP                                                      ->66
   14    34    >   ASSIGN                                                   !1, <array>
   15    35        INIT_FCALL                                               'hexdec'
         36        INIT_FCALL                                               'substr'
         37        SEND_VAR                                                 !0
         38        SEND_VAL                                                 0
         39        SEND_VAL                                                 2
         40        DO_ICALL                                         $24     
         41        SEND_VAR                                                 $24
         42        DO_ICALL                                         $25     
         43        ASSIGN_DIM                                               !1, 0
         44        OP_DATA                                                  $25
   16    45        INIT_FCALL                                               'hexdec'
         46        INIT_FCALL                                               'substr'
         47        SEND_VAR                                                 !0
         48        SEND_VAL                                                 2
         49        SEND_VAL                                                 2
         50        DO_ICALL                                         $27     
         51        SEND_VAR                                                 $27
         52        DO_ICALL                                         $28     
         53        ASSIGN_DIM                                               !1, 1
         54        OP_DATA                                                  $28
   17    55        INIT_FCALL                                               'hexdec'
         56        INIT_FCALL                                               'substr'
         57        SEND_VAR                                                 !0
         58        SEND_VAL                                                 4
         59        SEND_VAL                                                 2
         60        DO_ICALL                                         $30     
         61        SEND_VAR                                                 $30
         62        DO_ICALL                                         $31     
         63        ASSIGN_DIM                                               !1, 2
         64        OP_DATA                                                  $31
   18    65      > RETURN                                                   !1
   20    66    > > RETURN                                                   null

End of function hex2rgb

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.75 ms | 1400 KiB | 19 Q