Hello i have a page that parses an html to an array How can i save this array so when the user refreshes the page it does not do the parsing again? THANKS!!!!!!!
save the array as a session
http://us2.php.net/manual/en/book.session.php
Probably the easiest is storing the array into a Session.
i m not sure i understood it 🙂 I start a session on the begging of the page and then the variables inside $_SESSION are kept?
Yes. Sessions 'Live on' between pages. Just make sure you place a session_start at the top of the pages.
then:
// page 1: $parsed_html = parse($html); $_SESSION['TheData'] = $parsed_html; //page 2: print_r($_SESSION['TheData']);
Thanks! And how do i pass an array not just a variable?
an array is just a variable ; exactly the same way