$final_amount = (strpos($voucher, ‘%’) !== false) ? $amount – ($amount * substr_count($voucher, ‘%’) / 100) : ”; return $final_amount;