I have some trouble which I have no clue how to solve this. What I need is to replace values in non-associative array with a function and print out as variable.
function Confirm($var1)
{
switch ($var1)
{
case 1:
return "Gas";
break;
case 2:
return "Soda";
break;
case 3:
return "Air";
break;
case 4:
return "Ice";
break;
case 5:
return "Soft";
break;
}
}
$db_field_data = "1,2,3,5";
what i need is:
$field_data_trough_function = "Gas,Soda,Air,Soft";
$db_field_data = [1,2,3,5];... 1,2,3,5 is a typo or would be 1,2,3,4,5 ?