© Gunnard Engebreth, Satej Kumar Sahu 2023
G. Engebreth, S. K. SahuPHP 8 Basicshttps://doi.org/10.1007/978-1-4842-8082-9_7

7. Sessions and Cookies

Gunnard Engebreth1   and Satej Kumar Sahu2
(1)
Madison, WI, USA
(2)
Bangalore, India
 

In the previous chapters, you learned how to use arrays, one of the most versatile and useful elements in PHP, to store multiple values within a single variable. Let’s now imagine you need to store some information to be used across multiple web pages. You need to store some information on a local computer (client side) or store some information on a server (server side) for just a certain time using the web page. How would you do this? By using sessions and cookies.

The main difference between sessions and cookies is that ...

Get PHP 8 Basics: For Programming and Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.