difference between Session and Cookies in PHP

A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests.

Cookies are a way for the server to store the information on the user’s machine so that it can remember the user. Each time the same computer requests a page with a browser, it will send the cookie too.

Sessions store data on the server, not on the browser like cookies Sessions are more secure than cookies.

PHP sessions, unlike cookies which are just stored on the user’s browser, need a temporary directory on the server where PHP can store the session data.