Quick Answer
Session stores data on the server between requests. session_start() initializes it. Data stored in $_SESSION["key"] = value. Session ID sent to client via cookie (PHPSESSID). On next request, client sends the ID and PHP loads the session data. Sessions expire on browser close (or timeout). More secure than cookies (data on server). Store user ID in session, not sensitive data like passwords.
Answer
Sessions store user-specific data on the server and persist across requests.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.
PHP interview questions and answers for beginner, junior, mid-level, senior, and expert developers. Ideal for freshers and experienced candidates preparing for PHP roles.