I have an array like:-
array(1,3,5,7,10,12)
I want to replace the numbers in the array with other fixed values. Example:-
1 -> 12
2 -> 44
3 -> 32
4 -> 27
5 -> 11
etc.
What is the best way to change these values in PHP?
I have an array like:-
array(1,3,5,7,10,12)
I want to replace the numbers in the array with other fixed values. Example:-
1 -> 12
2 -> 44
3 -> 32
4 -> 27
5 -> 11
etc.
What is the best way to change these values in PHP?
I see the way to have a switchcase in a foreach, but i don't know if it is the best way.
foreach ($values as $value){
switch ($value){
case 0:
//make relative change;
break;
case 1:
//make relative change;
break;
case 2:
//make relative change;
break;
}