Search code examples
phpwordpressexplode

How can I convert the WordPress string meta_key value into simpler array?


a:1:{s:13:"administrator";b:1;}

I want to break this down and convert into some sort of array.


Solution

  • You can use maybe_unserialize( 'a:1:{s:13:"administrator";b:1;}' ) function of wordpress for better output. Just pass the serialize string and it will return you an array.