Hyphenation is used when a noun is being modified. Eg. 18-year-old boy. 18-year-old modifies boy. You are behaving like a two-year-old. (noun = two-year-old)
- In this example we’re using that hyphenated phrase with the indefinite article in a pronominal sense. It really means “an 18-year-old child, so it’s like a substitute pronoun. As such, it still represents one linguistic entity, one pronoun, so it needs to be hyphenated to aid the reader in understanding that the three words are being connected to act as one item.
When there isn’t a noun to modify, using hyphenation would be incorrect. Eg. The boy an 18 year old. The boy is 18 years old.