Converting string / array with php

I am manually reading database entries from a plugin (eventscalendar wordpress). custom fields / custom fields are stored in the database. excuse my ignorance - but I am having trouble binding the format in which the data is stored:

a:1:{s:3:"key";s:6:"extern";}

      

so I end up needing the value s: 6: "" in a simple variable. say $ key = "extern"

any quick solutions? thanks, sign

+3


source to share


2 answers


Take a look at unserialize to get it back into an array: http://php.net/manual/en/function.unserialize.php



+6


source


This is a serialized array - notice at a

the beginning. He also works with objects.

It is created with PHP serialize

and converted back to the correct array / object with unserialize

.



It serves a similar purpose for the format JSON

.

+1


source







All Articles