Humour shows up in many places, but one function of laughing and crying is to distract the individual while new connections are made in the brain, either physically or functionally.

Think of an update being loaded into your computer. Because you are also using the computer, the human computer needs to distract you for a few seconds while the update is implemented.

As the updates can be of an extremely wide variety of forms, so can humour. You can make a new connection, which is what much of the humour comedians produce is, or status change, either yours or the object of the joke, irony also requires new connections and so on.

So from an almost mechanical perspective, laughing, crying, shocked surprise, shock-injury all put consciousness into a kind of neutral or distracted mode for a short interval.

Little wonder, then, that one can fall down laughing, rolling on the floor etc: humour so intense that even normal functions can not be performed.and then you could die laughing