3v4l.org

run code in 500+ PHP versions simultaneously
<?php // RYB color to RGB color function RYB2RGB($iRed, $iYellow, $iBlue){ // Save the RYB $original_ryb = [$iRed, $iYellow, $iBlue]; // Remove the whiteness from the color. $iWhite = min($iRed, $iYellow, $iBlue); $iRed -= $iWhite; $iYellow -= $iWhite; $iBlue -= $iWhite; $iMaxYellow = max($iRed, $iYellow, $iBlue); // Get the green out of the yellow and blue $iGreen = min($iYellow, $iBlue); $iYellow -= $iGreen; $iBlue -= $iGreen; if ($iBlue > 0 && $iGreen > 0) { $iBlue *= 2.0; $iGreen *= 2.0; } // Redistribute the remaining yellow. $iRed += $iYellow; $iGreen += $iYellow; // Normalize to values. $iMaxGreen = max($iRed, $iGreen, $iBlue); if ($iMaxGreen > 0) { $iN = $iMaxYellow / $iMaxGreen; $iRed *= $iN; $iGreen *= $iN; $iBlue *= $iN; } // Add the white back $in. $iRed += $iWhite; $iGreen += $iWhite; $iBlue += $iWhite; // Save the RGB $RGB = [floor($iRed), floor($iGreen), floor($iBlue)]; return $RGB; } $R = 98; $y = 152; $b = 223; var_dump( RYB2RGB( $R, $y, $b ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CmWRc
function name:  (null)
number of ops:  12
compiled vars:  !0 = $R, !1 = $y, !2 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   56     0  E >   ASSIGN                                                       !0, 98
   57     1        ASSIGN                                                       !1, 152
   58     2        ASSIGN                                                       !2, 223
   60     3        INIT_FCALL                                                   'var_dump'
          4        INIT_FCALL                                                   'ryb2rgb'
          5        SEND_VAR                                                     !0
          6        SEND_VAR                                                     !1
          7        SEND_VAR                                                     !2
          8        DO_FCALL                                          0  $6      
          9        SEND_VAR                                                     $6
         10        DO_ICALL                                                     
         11      > RETURN                                                       1

Function ryb2rgb:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 48
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
Branch analysis from position: 33
Branch analysis from position: 30
filename:       /in/CmWRc
function name:  RYB2RGB
number of ops:  66
compiled vars:  !0 = $iRed, !1 = $iYellow, !2 = $iBlue, !3 = $original_ryb, !4 = $iWhite, !5 = $iMaxYellow, !6 = $iGreen, !7 = $iMaxGreen, !8 = $iN, !9 = $RGB
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
    6     3        INIT_ARRAY                                           ~10     !0
          4        ADD_ARRAY_ELEMENT                                    ~10     !1
          5        ADD_ARRAY_ELEMENT                                    ~10     !2
          6        ASSIGN                                                       !3, ~10
    9     7        INIT_FCALL                                                   'min'
          8        SEND_VAR                                                     !0
          9        SEND_VAR                                                     !1
         10        SEND_VAR                                                     !2
         11        DO_ICALL                                             $12     
         12        ASSIGN                                                       !4, $12
   11    13        ASSIGN_OP                                         2          !0, !4
   12    14        ASSIGN_OP                                         2          !1, !4
   13    15        ASSIGN_OP                                         2          !2, !4
   15    16        INIT_FCALL                                                   'max'
         17        SEND_VAR                                                     !0
         18        SEND_VAR                                                     !1
         19        SEND_VAR                                                     !2
         20        DO_ICALL                                             $17     
         21        ASSIGN                                                       !5, $17
   18    22        FRAMELESS_ICALL_2                min                 ~19     !1, !2
         23        ASSIGN                                                       !6, ~19
   20    24        ASSIGN_OP                                         2          !1, !6
   21    25        ASSIGN_OP                                         2          !2, !6
   23    26        IS_SMALLER                                           ~23     0, !2
         27      > JMPZ_EX                                              ~23     ~23, ->30
         28    >   IS_SMALLER                                           ~24     0, !6
         29        BOOL                                                 ~23     ~24
         30    > > JMPZ                                                         ~23, ->33
   25    31    >   ASSIGN_OP                                         3          !2, 2
   26    32        ASSIGN_OP                                         3          !6, 2
   30    33    >   ASSIGN_OP                                         1          !0, !1
   31    34        ASSIGN_OP                                         1          !6, !1
   34    35        INIT_FCALL                                                   'max'
         36        SEND_VAR                                                     !0
         37        SEND_VAR                                                     !6
         38        SEND_VAR                                                     !2
         39        DO_ICALL                                             $29     
         40        ASSIGN                                                       !7, $29
   36    41        IS_SMALLER                                                   0, !7
         42      > JMPZ                                                         ~31, ->48
   38    43    >   DIV                                                  ~32     !5, !7
         44        ASSIGN                                                       !8, ~32
   40    45        ASSIGN_OP                                         3          !0, !8
   41    46        ASSIGN_OP                                         3          !6, !8
   42    47        ASSIGN_OP                                         3          !2, !8
   46    48    >   ASSIGN_OP                                         1          !0, !4
   47    49        ASSIGN_OP                                         1          !6, !4
   48    50        ASSIGN_OP                                         1          !2, !4
   51    51        INIT_FCALL                                                   'floor'
         52        SEND_VAR                                                     !0
         53        DO_ICALL                                             $40     
         54        INIT_ARRAY                                           ~41     $40
         55        INIT_FCALL                                                   'floor'
         56        SEND_VAR                                                     !6
         57        DO_ICALL                                             $42     
         58        ADD_ARRAY_ELEMENT                                    ~41     $42
         59        INIT_FCALL                                                   'floor'
         60        SEND_VAR                                                     !2
         61        DO_ICALL                                             $43     
         62        ADD_ARRAY_ELEMENT                                    ~41     $43
         63        ASSIGN                                                       !9, ~41
   53    64      > RETURN                                                       !9
   54    65*     > RETURN                                                       null

End of function ryb2rgb

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.05 ms | 2301 KiB | 18 Q