i’ve known this for a while but forgot to share it. there is a very easy way you can store array into database as a string. then you can grab the string from the database and convert it back into an array.
code example:
<?php $myarray[] = "meow"; $myarray[] = "woof"; $myarray[meow] = "cool"; $myarray[woof] = "cool"; $myarray[thisrules][0] = "Mmmm"; $text_myarray = serialize($myarray); // store it into my database (depend on the length of your array, declare the column as text or varchar) // pull it out of my database, suppose $out_of_my_database stores the text from your database column // then $get_myarray = unserialize($out_of_my_database); echo "<pre>"; print_r($get_myarray); ?>
you should get
Array ( [0] => meow [1] => woof [meow] => cool [woof] => cool [thisrules] => Array ( [0] => Mmmm ) )
Woah, that is so awesome. Definitely helpful, thanks a lot.
Thanks for sharing sis! 🙂 I didn’t know that. hehe
Beyond wonder…I don’t understand a thing ^^
thanks after 6 years :X