3v4l.org

run code in 300+ PHP versions simultaneously
<?php print_r(hex2rgb("#CCDDFF")); function hex2rgb($hex) { if (substr($hex,0,1)=="#") $hex=substr($hex, 1); if (strlen($hex)==3) $hex=$hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; elseif (strlen($hex)!=6) return false; $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; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nLAG0
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                                              '%23CCDDFF'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   16     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 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 33
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
Branch analysis from position: 13
filename:       /in/nLAG0
function name:  hex2rgb
number of ops:  66
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
          8    >   INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 1
         11        DO_ICALL                                         $4      
         12        ASSIGN                                                   !0, $4
    7    13    >   STRLEN                                           ~6      !0
         14        IS_EQUAL                                                 ~6, 3
         15      > JMPZ                                                     ~7, ->29
         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                                                      ->33
    8    29    >   STRLEN                                           ~20     !0
         30        IS_NOT_EQUAL                                             ~20, 6
         31      > JMPZ                                                     ~21, ->33
         32    > > RETURN                                                   <false>
    9    33    >   ASSIGN                                                   !1, <array>
   10    34        INIT_FCALL                                               'hexdec'
         35        INIT_FCALL                                               'substr'
         36        SEND_VAR                                                 !0
         37        SEND_VAL                                                 0
         38        SEND_VAL                                                 2
         39        DO_ICALL                                         $24     
         40        SEND_VAR                                                 $24
         41        DO_ICALL                                         $25     
         42        ASSIGN_DIM                                               !1, 0
         43        OP_DATA                                                  $25
   11    44        INIT_FCALL                                               'hexdec'
         45        INIT_FCALL                                               'substr'
         46        SEND_VAR                                                 !0
         47        SEND_VAL                                                 2
         48        SEND_VAL                                                 2
         49        DO_ICALL                                         $27     
         50        SEND_VAR                                                 $27
         51        DO_ICALL                                         $28     
         52        ASSIGN_DIM                                               !1, 1
         53        OP_DATA                                                  $28
   12    54        INIT_FCALL                                               'hexdec'
         55        INIT_FCALL                                               'substr'
         56        SEND_VAR                                                 !0
         57        SEND_VAL                                                 4
         58        SEND_VAL                                                 2
         59        DO_ICALL                                         $30     
         60        SEND_VAR                                                 $30
         61        DO_ICALL                                         $31     
         62        ASSIGN_DIM                                               !1, 2
         63        OP_DATA                                                  $31
   13    64      > RETURN                                                   !1
   14    65*     > RETURN                                                   null

End of function hex2rgb

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.2 ms | 1400 KiB | 19 Q