Question

Bellow is the content of one SQL row in my wordpress db:

a:1:{s:5:"codes";a:5:{s:26:"AFFIL2014-I0AILGLNYG3UEAJI";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-XNAGS9YZMUMHD0PS";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-WO3X0YJLVHUZCZH6";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:0;s:5:"users";a:1:{i:0;s:13:"testaccount22";}}s:26:"AFFIL2014-PEWHTTOWIZPXQJYU";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-Y6PTEJT2GLRIVF0J";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}}}

I've never seen anything like this before. It looks like array, but I have no idea how to display this content on my PHP page.

Was it helpful?

Solution

It's called as a serialize string. You need to use unserialize function to converts it back into a PHP value.

Working Demo.

OTHER TIPS

$serialized = 'a:1:{s:5:"codes";a:5:{s:26:"AFFIL2014-I0AILGLNYG3UEAJI";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-XNAGS9YZMUMHD0PS";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-WO3X0YJLVHUZCZH6";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:0;s:5:"users";a:1:{i:0;s:13:"testaccount22";}}s:26:"AFFIL2014-PEWHTTOWIZPXQJYU";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-Y6PTEJT2GLRIVF0J";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}}}';


$unserialized = unserialize($serialized);


print_r($unserialized);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top