0

I have an array on my site created by a plugin and it contains an array of information but the array doesnt seem to be structured the way I would expect.

When I do var_dump on the array this is what I get -

$sub = get_user_meta( $user_id->ID, 'stripe-subscription');
echo var_dump($sub);

array(1) { [0]=> string(365) "a:13:{s:2:"id";s:18:"sub_EFITdasvYbqTR8";s:20:"current_period_start";i:1546113219;s:18:"current_period_end";i:1546199619;s:8:"customer";s:18:"cus_EFITA9krrWZz6F";s:6:"status";s:6:"active";s:6:"planid";s:19:"plan_Dw2XqfIefXzqWZ";s:9:"plan_name";N;s:4:"cost";i:5000;s:8:"currency";s:3:"usd";s:8:"interval";s:3:"day";s:5:"trial";i:0;s:9:"recipient";N;s:7:"counter";N;}" }

And what I need to do is be able to echo each key/value such as --

"status";s:6:"active"
echo $status;

I've tried array_shift and also - $pre_sub = implode(array_keys($sub['status']));

How do I retrieve the specific values?

730wavy
  • 944
  • 1
  • 19
  • 57

0 Answers0