Ken
Ken

Reputation: 833

How to get specific value from serialized array?

Im having a hard time digging how can I get the specific value on this serialized array:

a:8:{s:13:"store_address";s:0:"";s:14:"country_select";s:2:"PH";s:13:"region_select";s:3:"MLA";s:10:"aboutstore";s:339:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifend turpis at arcu luctus placerat. Duis rhoncus auctor tincidunt. Aenean id nisi tortor, hendrerit sagittis elit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam nibh massa, consectetur vel ultrices a, rhoncus at lectus.";s:16:"year_established";s:0:"";s:14:"contact_number";s:0:"";s:13:"facebook_page";s:0:"";s:12:"twitter_page";s:0:"";}

For example I want to get the aboutstore value.. How to get this specific value?

Upvotes: 0

Views: 137

Answers (1)

scrowler
scrowler

Reputation: 24406

Simple, you need to unserialize the data, then you can access it as an associative array:

$data = unserialize($your_string_of_serialized_data);

echo $data['aboutstore'];

Upvotes: 3

Related Questions