Reputation: 163
I'm trying to figure out what type of array is that:
I found it on a Wordpress database, how can I tranform into a json string?
a:6{i:0;s:3:\"948\";i:1;s:3:\"949\";i:2;s:3:\"951\";i:3;s:3:\"952\";i:4;s:3:\"953\";i:5;s:4:\"1742\";}
Upvotes: 0
Views: 35
Reputation: 1042
It seems that the data is corrupted:
$content = 'a:6:{i:0;s:3:"948";i:1;s:3:"949";i:2;s:3:"951";i:3;s:3:"952";i:4;s:3:"953";i:5;s:4:"1742";}'
json_encode(unserialize($content));
Note the missing colon after "a:6"
Upvotes: 1
Reputation: 884
It seems like generated by serialize(), you can unserialize it by invoking the method unserialize()
Upvotes: 0