//we place all the values into an array so we can run a function on them$values = @array($HD, $VD, $TD, $Dv, $Dh, $PC, $FC, $V, $A, $W, $FA, $MFv, $MFh, $GT1, $GT2);//we check to see if the user has filled in at least two variablesfunction atLeastTwo($values){ $counter = 0; foreach ($values as $value) { if ($value !== null) { $counter++; if ($counter == 2) { return false; } } } return true;}if (atLeastTwo($values)){ die "You Must fill in at least two fields before calculating";}