Log 1811

$field1 = “”; // replace with the value of the first field
$field2 = “”; // replace with the value of the second field
$field3 = “”; // replace with the value of the third field

$totalFields = 0;
$sum = 0;

if (!empty($field1)) {
$totalFields++;
$sum += $field1;
}

if (!empty($field2)) {
$totalFields++;
$sum += $field2;
}

if (!empty($field3)) {
$totalFields++;
$sum += $field3;
}

$average = ($totalFields > 0) ? ($sum / $totalFields) : “”;

return “The average is: ” . $average;

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
  • Attributes
  • Custom attributes
  • Custom fields
Click outside to hide the comparison bar
Compare