Something like this:
$factor = count($inArray);
foreach($inArray as &$value) {
if($value != "x") {
$value *= $factor;
} else {
$value = $factor.'*'.$value;
}
$factor--;
}
unset($value);
Value of $inArray would be:
0,9,72,56,30,5*x,32,0,6,0
1
solved Selecting array elements in PHP