$value should come in as a string (if it doesn't, trim() will cast it to one anyway...