3v4l.org

run code in 300+ 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 = 31, Position 2 = 33
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 51
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
Branch analysis from position: 36
Branch analysis from position: 33
filename:       /in/CmWRc
function name:  RYB2RGB
number of ops:  69
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        INIT_FCALL                                               'min'
         23        SEND_VAR                                                 !1
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $19     
         26        ASSIGN                                                   !6, $19
   20    27        ASSIGN_OP                                     2          !1, !6
   21    28        ASSIGN_OP                                     2          !2, !6
   23    29        IS_SMALLER                                       ~23     0, !2
         30      > JMPZ_EX                                          ~23     ~23, ->33
         31    >   IS_SMALLER                                       ~24     0, !6
         32        BOOL                                             ~23     ~24
         33    > > JMPZ                                                     ~23, ->36
   25    34    >   ASSIGN_OP                                     3          !2, 2
   26    35        ASSIGN_OP                                     3          !6, 2
   30    36    >   ASSIGN_OP                                     1          !0, !1
   31    37        ASSIGN_OP                                     1          !6, !1
   34    38        INIT_FCALL                                               'max'
         39        SEND_VAR                                                 !0
         40        SEND_VAR                                                 !6
         41        SEND_VAR                                                 !2
         42        DO_ICALL                                         $29     
         43        ASSIGN                                                   !7, $29
   36    44        IS_SMALLER                                               0, !7
         45      > JMPZ                                                     ~31, ->51
   38    46    >   DIV                                              ~32     !5, !7
         47        ASSIGN                                                   !8, ~32
   40    48        ASSIGN_OP                                     3          !0, !8
   41    49        ASSIGN_OP                                     3          !6, !8
   42    50        ASSIGN_OP                                     3          !2, !8
   46    51    >   ASSIGN_OP                                     1          !0, !4
   47    52        ASSIGN_OP                                     1          !6, !4
   48    53        ASSIGN_OP                                     1          !2, !4
   51    54        INIT_FCALL                                               'floor'
         55        SEND_VAR                                                 !0
         56        DO_ICALL                                         $40     
         57        INIT_ARRAY                                       ~41     $40
         58        INIT_FCALL                                               'floor'
         59        SEND_VAR                                                 !6
         60        DO_ICALL                                         $42     
         61        ADD_ARRAY_ELEMENT                                ~41     $42
         62        INIT_FCALL                                               'floor'
         63        SEND_VAR                                                 !2
         64        DO_ICALL                                         $43     
         65        ADD_ARRAY_ELEMENT                                ~41     $43
         66        ASSIGN                                                   !9, ~41
   53    67      > RETURN                                                   !9
   54    68*     > RETURN                                                   null

End of function ryb2rgb

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.87 ms | 1021 KiB | 18 Q