I have an array of english colors and I want to translate some of them to frensh, I didn't find a standard PHP function to replace some value of an array with other, So I wrote my own but I'm looking for a simpler way if there is!
I'm looping through the englishColors array and checking if there is the colors that I want to replace with frensh colors.
$englishColors = array("Black","Green","Red");
$frenshColors = array();
foreach ($englishColors as $color) {
if ($color == "Black") {
$frenshColors[] = "Noire";
continue;
}elseif ($color == "Red") {
$frenshColors[] = "Rouge";
continue;
}
$frenshColors[] = $color;
}
var_dump($frenshColors);