Jump to content


Photo

How to convert an recursive array into a string and vice versa


  • Please log in to reply
4 replies to this topic

#1 Horst Azeglio

Horst Azeglio
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 02 May 2006 - 10:38 PM

Maybe this belongs to the "PHP Newbie forum, but whatver..."

Let's say I have an array which contains array which contain arrays etc...
How can I convert it to a string so I can put it in a MySQL entry in order to take it back later?

Maybe there's a smarter way to do what I'm trying to do. Any ideas? Thank you.

#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 02 May 2006 - 10:55 PM

Could you post up your code so far, or even an explination of what you are trying to acheive with your matryoshka-like arrays - Maybe it could be done without all of the nested arrays.

#3 Horst Azeglio

Horst Azeglio
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 02 May 2006 - 10:58 PM

I'm sure it can be done without nested arrays, but I'm sure I will need to convert matryoshka-like arrays to strings someday.

#4 sasa

sasa
  • Staff Alumni
  • Advanced Member
  • 2,804 posts
  • LocationHrvatska

Posted 02 May 2006 - 11:02 PM

[!--quoteo(post=370727:date=May 3 2006, 12:58 AM:name=Horst Azeglio)--][div class=\'quotetop\']QUOTE(Horst Azeglio @ May 3 2006, 12:58 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I'm sure it can be done without nested arrays, but I'm sure I will need to convert matryoshka-like arrays to strings someday.
[/quote]
look serialize()

#5 Horst Azeglio

Horst Azeglio
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 02 May 2006 - 11:06 PM

Thanks a lot sasa, it works perfectly, thank you too SemiApocalyptic




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users