+ 2

Storing arrays into sessions Php

Can anybody please explain to my understanding how to store arrays into sessions. An example. Storing e-commerce data into sessions

30th Mar 2021, 4:56 PM
Henry Egyir Junior Danso
Henry Egyir Junior Danso - avatar
1 ответ
+ 2
Storing an array in $_SESSION is like storing any other data type in it. This article gives more detailed explaination and an example. https://thisinterestsme.com/store-array-session-php/ Don't forget to always run session_start() exactly once for every HTTP request you want to use $_SESSION and do this before sending any content other than headers. This is critical for any use of $_SESSION because it initializes $_SESSION. Forgetting to call session_start is a very common mistake.
30th Mar 2021, 8:07 PM
Josh Greig
Josh Greig - avatar