“If I can stay funny, I can stay alive,” the star says of his time in rehab after his stroke