3v4l.org

run code in 300+ PHP versions simultaneously
<?php function HSL2RGB($h, $s, $l) { $s = max(0, min($s, 100)); $l = max(0, min($l, 100)); $s = $s/100; $l = $l/100; $h = $h >= 360 ? $h % 360 : $h; $c = ( 1 - abs( 2 * $l - 1 ) ) * $s; $x = $c * ( 1 - abs( fmod( ( $h / 60 ), 2 ) - 1 ) ); $m = $l - ( $c / 2 ); if ( $h < 60 ) { $r = $c; $g = $x; $b = 0; } else if ( $h < 120 ) { $r = $x; $g = $c; $b = 0; } else if ( $h < 180 ) { $r = 0; $g = $c; $b = $x; } else if ( $h < 240 ) { $r = 0; $g = $x; $b = $c; } else if ( $h < 300 ) { $r = $x; $g = 0; $b = $c; } else { $r = $c; $g = 0; $b = $x; } $r = ( $r + $m ) * 255; $g = ( $g + $m ) * 255; $b = ( $b + $m ) * 255; return [$r, $g, $b]; } print_r(HSL2RGB(50, 100, 100));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q72pg
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'hsl2rgb'
          2        SEND_VAL                                                 50
          3        SEND_VAL                                                 100
          4        SEND_VAL                                                 100
          5        DO_FCALL                                      0  $0      
          6        SEND_VAR                                                 $0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function hsl2rgb:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 61
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 67
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
Branch analysis from position: 67
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 73
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
Branch analysis from position: 73
2 jumps found. (Code = 43) Position 1 = 75, Position 2 = 79
Branch analysis from position: 75
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
Branch analysis from position: 79
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 85
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
Branch analysis from position: 85
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 61
Branch analysis from position: 57
Branch analysis from position: 61
filename:       /in/Q72pg
function name:  HSL2RGB
number of ops:  102
compiled vars:  !0 = $h, !1 = $s, !2 = $l, !3 = $c, !4 = $x, !5 = $m, !6 = $r, !7 = $g, !8 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    5     3        INIT_FCALL                                               'max'
          4        SEND_VAL                                                 0
          5        INIT_FCALL                                               'min'
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 100
          8        DO_ICALL                                         $9      
          9        SEND_VAR                                                 $9
         10        DO_ICALL                                         $10     
         11        ASSIGN                                                   !1, $10
    6    12        INIT_FCALL                                               'max'
         13        SEND_VAL                                                 0
         14        INIT_FCALL                                               'min'
         15        SEND_VAR                                                 !2
         16        SEND_VAL                                                 100
         17        DO_ICALL                                         $12     
         18        SEND_VAR                                                 $12
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !2, $13
    8    21        DIV                                              ~15     !1, 100
         22        ASSIGN                                                   !1, ~15
    9    23        DIV                                              ~17     !2, 100
         24        ASSIGN                                                   !2, ~17
   10    25        IS_SMALLER_OR_EQUAL                                      360, !0
         26      > JMPZ                                                     ~19, ->30
         27    >   MOD                                              ~20     !0, 360
         28        QM_ASSIGN                                        ~21     ~20
         29      > JMP                                                      ->31
         30    >   QM_ASSIGN                                        ~21     !0
         31    >   ASSIGN                                                   !0, ~21
   12    32        INIT_FCALL                                               'abs'
         33        MUL                                              ~23     !2, 2
         34        SUB                                              ~24     ~23, 1
         35        SEND_VAL                                                 ~24
         36        DO_ICALL                                         $25     
         37        SUB                                              ~26     1, $25
         38        MUL                                              ~27     !1, ~26
         39        ASSIGN                                                   !3, ~27
   13    40        INIT_FCALL                                               'abs'
         41        INIT_FCALL                                               'fmod'
         42        DIV                                              ~29     !0, 60
         43        SEND_VAL                                                 ~29
         44        SEND_VAL                                                 2
         45        DO_ICALL                                         $30     
         46        SUB                                              ~31     $30, 1
         47        SEND_VAL                                                 ~31
         48        DO_ICALL                                         $32     
         49        SUB                                              ~33     1, $32
         50        MUL                                              ~34     !3, ~33
         51        ASSIGN                                                   !4, ~34
   14    52        DIV                                              ~36     !3, 2
         53        SUB                                              ~37     !2, ~36
         54        ASSIGN                                                   !5, ~37
   16    55        IS_SMALLER                                               !0, 60
         56      > JMPZ                                                     ~39, ->61
   17    57    >   ASSIGN                                                   !6, !3
   18    58        ASSIGN                                                   !7, !4
   19    59        ASSIGN                                                   !8, 0
         60      > JMP                                                      ->88
   20    61    >   IS_SMALLER                                               !0, 120
         62      > JMPZ                                                     ~43, ->67
   21    63    >   ASSIGN                                                   !6, !4
   22    64        ASSIGN                                                   !7, !3
   23    65        ASSIGN                                                   !8, 0
         66      > JMP                                                      ->88
   24    67    >   IS_SMALLER                                               !0, 180
         68      > JMPZ                                                     ~47, ->73
   25    69    >   ASSIGN                                                   !6, 0
   26    70        ASSIGN                                                   !7, !3
   27    71        ASSIGN                                                   !8, !4
         72      > JMP                                                      ->88
   28    73    >   IS_SMALLER                                               !0, 240
         74      > JMPZ                                                     ~51, ->79
   29    75    >   ASSIGN                                                   !6, 0
   30    76        ASSIGN                                                   !7, !4
   31    77        ASSIGN                                                   !8, !3
         78      > JMP                                                      ->88
   32    79    >   IS_SMALLER                                               !0, 300
         80      > JMPZ                                                     ~55, ->85
   33    81    >   ASSIGN                                                   !6, !4
   34    82        ASSIGN                                                   !7, 0
   35    83        ASSIGN                                                   !8, !3
         84      > JMP                                                      ->88
   37    85    >   ASSIGN                                                   !6, !3
   38    86        ASSIGN                                                   !7, 0
   39    87        ASSIGN                                                   !8, !4
   42    88    >   ADD                                              ~62     !6, !5
         89        MUL                                              ~63     ~62, 255
         90        ASSIGN                                                   !6, ~63
   43    91        ADD                                              ~65     !7, !5
         92        MUL                                              ~66     ~65, 255
         93        ASSIGN                                                   !7, ~66
   44    94        ADD                                              ~68     !8, !5
         95        MUL                                              ~69     ~68, 255
         96        ASSIGN                                                   !8, ~69
   46    97        INIT_ARRAY                                       ~71     !6
         98        ADD_ARRAY_ELEMENT                                ~71     !7
         99        ADD_ARRAY_ELEMENT                                ~71     !8
        100      > RETURN                                                   ~71
   47   101*     > RETURN                                                   null

End of function hsl2rgb

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.87 ms | 1410 KiB | 25 Q