I've got some custom data inputted into the postmeta table for each of my WooCommerce orders.
a:2:{i:6517;a:2:{i:0;a:5:{s:10:"first_name";s:5:"Roger";s:9:"last_name";s:6:"Rabbit";s:5:"email";s:19:"roger@benefacto.org";s:7:"is_lead";b:1;s:12:"is_cancelled";b:0;}i:1;a:5:{s:10:"first_name";s:7:"Jessica";s:9:"last_name";s:6:"Rabbit";s:5:"email";s:21:"Jessica@benefacto.org";s:7:"is_lead";b:0;s:12:"is_cancelled";b:0;}}i:6518;a:2:{i:0;a:5:{s:10:"first_name";s:6:"Mickey";s:9:"last_name";s:5:"Mouse";s:5:"email";s:20:"mickey@benefacto.org";s:7:"is_lead";b:0;s:12:"is_cancelled";b:0;}i:1;a:5:{s:10:"first_name";s:6:"Donald";s:9:"last_name";s:4:"Duck";s:5:"email";s:20:"donald@benefacto.org";s:7:"is_lead";b:0;s:12:"is_cancelled";b:0;}}}
-- EDIT ---
I initially assumed this was encoded with JSON, but following the answers below understand it is actually serialized data.
I want to convert this data into a PHP array - something like below - so I can play with it.
$data = array (
'6517' => array (
0 => array (
'first_name' => 'Roger',
'last_name' => 'Rabit',
'email' => 'roger@benefacto.org',
'is_lead' => 1,
'is_cancelled' => 0,
),
1 => array (
'first_name' => 'Jessica',
'last_name' => 'Rabit',
'email' => 'jessica@benefacto.org',
'is_lead' => 0,
'is_cancelled' => 0,
)
),
'6518' => array (
0 => array (
'first_name' => 'Mickey',
'last_name' => 'Mouse',
'email' => 'mickey@benefacto.org',
'is_lead' => 1,
'is_cancelled' => 0,
),
1 => array (
'first_name' => 'Donald',
'last_name' => 'Duck',
'email' => 'donald@benefacto.org',
'is_lead' => 0,
'is_cancelled' => 0,
)
)
);
Any thoughts much appreciated!