shoover56 Posted October 31, 2013 Share Posted October 31, 2013 Good evening everyone. I am writing some custom code over a WP site and I noticed that a value I need to grab is encoded into a string from a mysql table such as this: a:3:{s:13:"checkout_type";s:14:"create-listing";s:4:"plan";i:41;s:6:"addons";a:0:{}} (The value i need to grab is the 41 in i:41) I'm just wondering if this is a 'type' of encoding and that a singular built in php function can do. If not, then I can do it on my own, just don't want to waste time exploding and str_replacing till I get it if it actually is a standard for metadata. Thank you kind gentlemen and lady developers -Steve Quote Link to comment Share on other sites More sharing options...
mentalist Posted October 31, 2013 Share Posted October 31, 2013 json http://php.net/manual/en/book.json.php Quote Link to comment Share on other sites More sharing options...
shoover56 Posted October 31, 2013 Author Share Posted October 31, 2013 Oh thanks mentalist. I actually did try json decoding it and it didn't work the first time. Guess I messed up on it. Quote Link to comment Share on other sites More sharing options...
boompa Posted November 1, 2013 Share Posted November 1, 2013 Nope, that's not JSON. Looks like a serialized array. You would use unserialize to get the PHP array out of it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.