Created
October 22, 2018 09:16
-
-
Save SalocinDotTEN/82993606824ae5f41c44cc77f490b025 to your computer and use it in GitHub Desktop.
Get a colour code based on inputted integer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$colours = array('#FDA...', '#83B...', '#53A...', '#BE3...', '#A24...'); | |
echo $colours[$integerParam % count($colours) - 1]; | |
//Expected output is the corresponding HEX colour based on the inputted $integerParam. | |
//Advantage is that the array can be added or shortened and it will work. | |
//Redacted colour code due to company restrictions. | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment