3v4l.org

run code in 300+ PHP versions simultaneously
<?php function usercolor( $username ) { $range = 192 - 64; $factor = $range / 256; $offset = 64; $base_hash = substr(md5($username), 0, 6); $b_R = hexdec(substr($base_hash,0,2)); $b_G = hexdec(substr($base_hash,2,2)); $b_B = hexdec(substr($base_hash,4,2)); $f_R = floor((floor($b_R * $factor) + $offset) / 16) * 16; $f_G = floor((floor($b_G * $factor) + $offset) / 16) * 16; $f_B = floor((floor($b_B * $factor) + $offset) / 16) * 16; return sprintf('#%02x%02x%02x', $f_R, $f_G, $f_B); } for( $i=0; $i<30; $i++ ) { $color = usercolor(rand()); echo '<div style="height: 100px; width: 100px; background-color: '.$color.'">'.$color.'</div>'."\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 2
Branch analysis from position: 17
Branch analysis from position: 2
filename:       /in/4tuWk
function name:  (null)
number of ops:  18
compiled vars:  !0 = $i, !1 = $color
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->15
   22     2    >   INIT_FCALL                                               'usercolor'
          3        INIT_FCALL                                               'rand'
          4        DO_ICALL                                         $3      
          5        SEND_VAR                                                 $3
          6        DO_FCALL                                      0  $4      
          7        ASSIGN                                                   !1, $4
   23     8        CONCAT                                           ~6      '%3Cdiv+style%3D%22height%3A+100px%3B+width%3A+100px%3B+background-color%3A+', !1
          9        CONCAT                                           ~7      ~6, '%22%3E'
         10        CONCAT                                           ~8      ~7, !1
         11        CONCAT                                           ~9      ~8, '%3C%2Fdiv%3E'
         12        CONCAT                                           ~10     ~9, '%0A'
         13        ECHO                                                     ~10
   21    14        PRE_INC                                                  !0
         15    >   IS_SMALLER                                               !0, 30
         16      > JMPNZ                                                    ~12, ->2
   24    17    > > RETURN                                                   1

Function usercolor:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4tuWk
function name:  usercolor
number of ops:  82
compiled vars:  !0 = $username, !1 = $range, !2 = $factor, !3 = $offset, !4 = $base_hash, !5 = $b_R, !6 = $b_G, !7 = $b_B, !8 = $f_R, !9 = $f_G, !10 = $f_B
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, 128
    6     2        DIV                                              ~12     !1, 256
          3        ASSIGN                                                   !2, ~12
    7     4        ASSIGN                                                   !3, 64
    9     5        INIT_FCALL                                               'substr'
          6        INIT_FCALL                                               'md5'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $15     
          9        SEND_VAR                                                 $15
         10        SEND_VAL                                                 0
         11        SEND_VAL                                                 6
         12        DO_ICALL                                         $16     
         13        ASSIGN                                                   !4, $16
   10    14        INIT_FCALL                                               'hexdec'
         15        INIT_FCALL                                               'substr'
         16        SEND_VAR                                                 !4
         17        SEND_VAL                                                 0
         18        SEND_VAL                                                 2
         19        DO_ICALL                                         $18     
         20        SEND_VAR                                                 $18
         21        DO_ICALL                                         $19     
         22        ASSIGN                                                   !5, $19
   11    23        INIT_FCALL                                               'hexdec'
         24        INIT_FCALL                                               'substr'
         25        SEND_VAR                                                 !4
         26        SEND_VAL                                                 2
         27        SEND_VAL                                                 2
         28        DO_ICALL                                         $21     
         29        SEND_VAR                                                 $21
         30        DO_ICALL                                         $22     
         31        ASSIGN                                                   !6, $22
   12    32        INIT_FCALL                                               'hexdec'
         33        INIT_FCALL                                               'substr'
         34        SEND_VAR                                                 !4
         35        SEND_VAL                                                 4
         36        SEND_VAL                                                 2
         37        DO_ICALL                                         $24     
         38        SEND_VAR                                                 $24
         39        DO_ICALL                                         $25     
         40        ASSIGN                                                   !7, $25
   14    41        INIT_FCALL                                               'floor'
         42        INIT_FCALL                                               'floor'
         43        MUL                                              ~27     !5, !2
         44        SEND_VAL                                                 ~27
         45        DO_ICALL                                         $28     
         46        ADD                                              ~29     $28, !3
         47        DIV                                              ~30     ~29, 16
         48        SEND_VAL                                                 ~30
         49        DO_ICALL                                         $31     
         50        MUL                                              ~32     $31, 16
         51        ASSIGN                                                   !8, ~32
   15    52        INIT_FCALL                                               'floor'
         53        INIT_FCALL                                               'floor'
         54        MUL                                              ~34     !6, !2
         55        SEND_VAL                                                 ~34
         56        DO_ICALL                                         $35     
         57        ADD                                              ~36     $35, !3
         58        DIV                                              ~37     ~36, 16
         59        SEND_VAL                                                 ~37
         60        DO_ICALL                                         $38     
         61        MUL                                              ~39     $38, 16
         62        ASSIGN                                                   !9, ~39
   16    63        INIT_FCALL                                               'floor'
         64        INIT_FCALL                                               'floor'
         65        MUL                                              ~41     !7, !2
         66        SEND_VAL                                                 ~41
         67        DO_ICALL                                         $42     
         68        ADD                                              ~43     $42, !3
         69        DIV                                              ~44     ~43, 16
         70        SEND_VAL                                                 ~44
         71        DO_ICALL                                         $45     
         72        MUL                                              ~46     $45, 16
         73        ASSIGN                                                   !10, ~46
   18    74        INIT_FCALL                                               'sprintf'
         75        SEND_VAL                                                 '%23%2502x%2502x%2502x'
         76        SEND_VAR                                                 !8
         77        SEND_VAR                                                 !9
         78        SEND_VAR                                                 !10
         79        DO_ICALL                                         $48     
         80      > RETURN                                                   $48
   19    81*     > RETURN                                                   null

End of function usercolor

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.91 ms | 1406 KiB | 26 Q