Hardly is an adverb commonly used to express the meaning of “barely” or “scarcely.” It indicates an extreme or minimal amount of something. For example, “I hardly slept last night” means the speaker only got a very small amount of sleep.
Additionally, it can be used to convey the meaning of “almost never” or “very rarely.” For instance, “I hardly ever eat fast food” implies that the person rarely consumes fast food.
In terms of grammar, hardly is often used in combination with the word “when” to indicate that something happens immediately after or almost at the same time as another event. For example, “Hardly had I closed the door when the phone rang,” means that the phone rang right after the speaker closed the door.