3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getContrastYIQ($hexcolor){ $r = hexdec(substr($hexcolor,0,2)); $g = hexdec(substr($hexcolor,2,2)); $b = hexdec(substr($hexcolor,4,2)); $yiq = (($r*299)+($g*587)+($b*114))/1000; return ($yiq >= 128) ? 'black' : 'white'; } echo getContrastYIQ();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H6ujd
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'getcontrastyiq'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function getcontrastyiq:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H6ujd
function name:  getContrastYIQ
number of ops:  42
compiled vars:  !0 = $hexcolor, !1 = $r, !2 = $g, !3 = $b, !4 = $yiq
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'hexdec'
          2        INIT_FCALL                                               'substr'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 2
          6        DO_ICALL                                         $5      
          7        SEND_VAR                                                 $5
          8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !1, $6
    4    10        INIT_FCALL                                               'hexdec'
         11        INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 2
         14        SEND_VAL                                                 2
         15        DO_ICALL                                         $8      
         16        SEND_VAR                                                 $8
         17        DO_ICALL                                         $9      
         18        ASSIGN                                                   !2, $9
    5    19        INIT_FCALL                                               'hexdec'
         20        INIT_FCALL                                               'substr'
         21        SEND_VAR                                                 !0
         22        SEND_VAL                                                 4
         23        SEND_VAL                                                 2
         24        DO_ICALL                                         $11     
         25        SEND_VAR                                                 $11
         26        DO_ICALL                                         $12     
         27        ASSIGN                                                   !3, $12
    6    28        MUL                                              ~14     !1, 299
         29        MUL                                              ~15     !2, 587
         30        ADD                                              ~16     ~14, ~15
         31        MUL                                              ~17     !3, 114
         32        ADD                                              ~18     ~16, ~17
         33        DIV                                              ~19     ~18, 1000
         34        ASSIGN                                                   !4, ~19
    7    35        IS_SMALLER_OR_EQUAL                                      128, !4
         36      > JMPZ                                                     ~21, ->39
         37    >   QM_ASSIGN                                        ~22     'black'
         38      > JMP                                                      ->40
         39    >   QM_ASSIGN                                        ~22     'white'
         40    > > RETURN                                                   ~22
    8    41*     > RETURN                                                   null

End of function getcontrastyiq

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.56 ms | 1403 KiB | 18 Q