1

I have a JSON string in my database such as this...

a:1:{s:26:"[email protected]";s:26:"[email protected]";}

After I fetch it from the database I use the following...

$my_array = json_decode($row2['json_data']);

The problem is that I'm not getting any array from $my_array. What am I doing wrong?

I've also tried the following...

$my_array = json_decode($row2['json_data'],true);

1 Answer 1

10

That's not a JSON string. That's a serialized array. You need to do the following:

$my_array = unserialize($row2['json_data']);
Sign up to request clarification or add additional context in comments.

1 Comment

I had to wait 14 minutes and then had to leave, yeah not a problem, thanks again.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.