Summarize this article:

When laughter strikes before you can stop it, excuse yourself. This gives you time to calm yourself and take a few deep breaths before rejoining everyone. Learn to recognize the sensation that comes before you laugh, and try to identify your laughter triggers so that you can excuse yourself in time.  Go to the restroom if you’re at a funeral or in the office. Walk away or get back in your car if you’re at an accident scene.  Leave the room if someone’s said something inappropriate. Put your hand over your mouth and make a coughing sound. If the laughter continues, use the coughing fit as an excuse to go to the restroom, where you can compose yourself.  This works well for times you start to involuntarily laugh before you have a chance to stop yourself. You can also pretend to blow your nose. Tell the person you often cope with upsetting feelings by laughing, then say you’re sorry if the reaction hurt them. Opening up to them will likely make them understand where you’re coming from, and it could help relieve your laughter by making you less nervous. Say, “I’m so sorry for laughing at your father’s funeral. I want you to know that I didn’t find anything funny, I just laugh when I feel sad. I hope that I haven’t hurt you.”
Move to a private location when you start to laugh, if you can. Cover up your laughter with a cough, if you don't have time to leave. Apologize for your laughter, if it still happens.