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 printf('#%02x%02x%02x', $f_R, $f_G, $f_B, false); } for( $i=0; $i<30; $i++ ) { printf('<div style="height: 100px; width: 100px; background-color: %s">&nbsp;</div>'."\n", usercolor(rand())); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 2
Branch analysis from position: 14
Branch analysis from position: 2
filename:       /in/UVqZG
function name:  (null)
number of ops:  15
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->12
   22     2    >   INIT_FCALL                                               'printf'
          3        SEND_VAL                                                 '%3Cdiv+style%3D%22height%3A+100px%3B+width%3A+100px%3B+background-color%3A+%25s%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A'
          4        INIT_FCALL                                               'usercolor'
          5        INIT_FCALL                                               'rand'
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_FCALL                                      0  $3      
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                                 
   21    11        PRE_INC                                                  !0
         12    >   IS_SMALLER                                               !0, 30
         13      > JMPNZ                                                    ~6, ->2
   23    14    > > RETURN                                                   1

Function usercolor:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UVqZG
function name:  usercolor
number of ops:  83
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                                               'printf'
         75        SEND_VAL                                                 '%23%2502x%2502x%2502x'
         76        SEND_VAR                                                 !8
         77        SEND_VAR                                                 !9
         78        SEND_VAR                                                 !10
         79        SEND_VAL                                                 <false>
         80        DO_ICALL                                         $48     
         81      > RETURN                                                   $48
   19    82*     > RETURN                                                   null

End of function usercolor

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.99 ms | 1407 KiB | 26 Q