I am curious of a better way of doing the code I have below, I find it repetitive and would like to cut down on it, any suggestions?

I was trying to do something with Variable Variables but I failed at getting that to work.

So basically I have a bunch of color names that I get with `$_GET[color-name-here']`

The goal is to set a color's code to a new color's code. So using the URL I am able to set the code for the color `red` to the color code of `green` so `red's value` would become `00FF00`

```
// Get color and color replacement values from URL
// get_value_or is ran through this code...
// isset($_GET[$key]) && !empty($_GET[$key]) ? $_GET[$key] : $default;
$red = get_value_or('red', null);
$orange = get_value_or('orange', null);
$yellow = get_value_or('yellow', null);
$green = get_value_or('green', null);
$turquoise = get_value_or('turquise', null);
$blue = get_value_or('blue', null);
$purple = get_value_or('purple', null);
$pink = get_value_or('pink', null);
$white = get_value_or('white', null);

// Define Default Color Name and Hexcode values
$colorsArray = array(
    'red' => 'FF0000',
    'orange' => 'FF5000',
    'yellow' => 'FFF200',
    'green' => '00FF00',
    'turquoise' => '00F0C8',
    'blue' => '0064FF',
    'purple' => '9F00FF',
    'pink' => 'FF0082',
    'white' => 'FFFFFF'
);

// Iterate Color Array and Set New Color Values if they exist
foreach($colorsArray as $colorName => $colorCode){

    // Do something to set each color Name with a New color code, if that color name has a value set

}

// Right now I am doing it manually for each color name, all 9+ like this...

//Set Reds NEW color value
if(isset($red)){
    $colorsArray['red'] = $colorsArray[$red];
}

//Set oranges NEW color value
if(isset($orange)){
    $colorsArray['orange'] = $colorsArray[$orange];
}

//Set yellows NEW color value
if(isset($yellow)){
    $colorsArray['yellow'] = $colorsArray[$yellow];
}

```

So any ideas how to set all the colors with less code?

A color's code should ONLY be updated if that color has a NEW value set in the URL using $\_GET variables

PS) I wasn't sure of a good title for this question, feel free to change it if you have a better one, thanks