I have this function that works the way I want it to. It gets a value between -2 to 2 to set the priority to choose between two strings.
My question is: How can I simplify the function?
function random_str($val){
if($var == '-2') { $out = array('str1','str2','str2','str2'); }else
if($var == '-1') { $out = array('str1','str2','str2'); }else
if($var == '0') { $out = array('str1','str2',); }else
if($var == '1') { $out = array('str1','str1','str2'); }else
if($var == '2') { $out = array('str1','str1','str1','str2'); }
return $out[array_rand($out)];
}