A headphone jack on the iPhone can become stuck in the headphone mode, in which no sound comes out of the iPhone even though the headphones are removed. A dirty jack or the mute switch being turned on are possible reasons for the heaphone mode being turned on. You'll need to turn off the headphone mode on the iPhone so that you can hear and enjoy sound from the device again without having headphones attached.
Insert a pair of headphones into the headphone jack at the top of the phone. Make sure you push the headphones all the way into the jack. Then remove the headphones from the jack. The headphone jack sensor can occasionally be activated as if a pair of headphones is still attached when they have been removed. Insert and remove the headphones several times to determine if inserting and removing the headphones fixes the problem.
Check the mute switch to make sure the sound hasn’t been turned off. The mute switch is on the upper-left side of the device when you hold the screen facing you. Toggle the switch to the "On" position. A bell will appear on the screen indicating the sound is On. A bell with a line through it indicates the sound has been turned off.
Use a toothpick to remove dirt or lint from the headphone jack. Move the toothpick around the inside of the hole to get rid of any gunk that may be preventing the headphone jack from properly registering.