What potential pitfalls should be considered when using session_start() in PHP scripts?

One potential pitfall when using session_start() in PHP scripts is that it must be called before any output is sent to the browser. If output is sent before session_start(), it can cause errors or prevent the session from being started properly. To avoid this issue, make sure to call session_start() at the beginning of your script before any HTML or whitespace.

<?php
// Correct way to start a session
session_start();

// Rest of your PHP code here
?>