Serialize PHP data

Asked

Viewed 35 times

2

how can I serialize the array below to save in BD?

Serializar array

I tried to serialize but it stayed that way:

a:2:{s:8:"produto1";a:2:{i:0;s:12:"Novo produto";i:1;s:1:"2";}s:8:"produto2";a:2:{i:0;s:12:"Bolo caseiro";i:1;s:1:"2";}}

I want it to be something like:

produto1:Novo produto,quantidade:2;produto2:Bolo caseiro,quantidade:2;

And so on, it’s possible?

  • 1

    json_encode() nonserver?

  • Kkkkkk that Noob that I am, worked perfectly. Thank you

1 answer

1

Try using json_encode in the array and save the string it generates.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.