To find out how many hours the plumber worked, you can use the formula:
\[ \text{Total charge} = \text{Hourly rate} \times \text{Number of hours} \]
In this case, the total charge is $180 and the hourly rate is $45. Plugging these values into the formula gives:
\[ 180 = 45 \times \text{Number of hours} \]
To find the number of hours, divide both sides by $45:
\[ \text{Number of hours} = \frac{180}{45} = 4 \]
Thus, the plumber worked for 4 hours.