private function error($type)
{
$error = "Error: Variable cannot be a";
// this just checks if the type starts with a vowel or "x" and displays either "a" or "an"
if (in_array(substr($type, 0, 1), ["a", "e", "i", "o", "u", "x"])) {
$error .= "n";
}
return $error . " " . $type . " type";
}