There's a much easier way to remember. Ball your two hands into fists in front of you and put them together so that you have your knuckles on top, sans thumbs. Start counting from left, knuckles are hills, the gap between them are valleys. Months falling on valleys are shorter. Months falling on hills are always 31 days.
- January is on a hill.
- February falls on a valley.
- March is hill.
- April is in a valley.
- May is on hill.
- June is valley.
- July is on a hill.
- August is on a hill too!
- September is in a valley.
- October is hill.
- November, valley.
- December ends on a hill.
You have a valley and a knuckle left.