The correct function that stomata perform in photosynthesis is:
3. gas exchange.
Stomata are small openings on the surfaces of leaves that allow for the exchange of gases between the plant and the environment, specifically the uptake of carbon dioxide (needed for photosynthesis) and the release of oxygen (a byproduct of photosynthesis).