oscttech900 Posted July 22, 2008 Share Posted July 22, 2008 I am pulling some data from a table that look like this: a:2:{i:10;a:2:{s:8:"shipping";s:28:"STANDARD 5 - 7 Business Days";s:5:"rates";a:1:{i:40;d:4.75;}}i:26;a:2:{s:8:"shipping";s:13:"Anxiety Wrap ";s:5:"rates";a:1:{i:20;d:6.75;}}} I want to have a function that will return me an array with just the 2 pieces of informaiton I need from this string... in this case the 2 shipping rates after the d: - so 4.75 and 6.75 Any ideas? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/116056-unserialize-some-data/ Share on other sites More sharing options...
effigy Posted July 22, 2008 Share Posted July 22, 2008 <pre> <?php $str = 'a:2:{i:10;a:2:{s:8:"shipping";s:28:"STANDARD 5 - 7 Business Days";s:5:"rates";a:1:{i:40;d:4.75;}}i:26;a:2:{s:8:"shipping";s:13:"Anxiety Wrap ";s:5:"rates";a:1:{i:20;d:6.75;}}}'; print_r(unserialize($str)); ?> </pre> Quote Link to comment https://forums.phpfreaks.com/topic/116056-unserialize-some-data/#findComment-596778 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.