How can I output specific elements in this php array? -


i using gravity forms wordpress , 1 of form elements list item can have multiple entries. have page on website building output data item onto page having trouble accessing actual items array.

this code using retrieve array:

$user_id = $current_user->id; $key = 'my_playlist'; $single = false;  $my_playlist = get_user_meta( $user_id, $key, $single ); print_r(array_values($my_playlist)); 

the output looks this:

array ( [0] => a:2:{i:0;a:2:{s:10:"song title";s:15:"test song title";s:11:"song artist";s:16:"test song artist";}i:1;a:2:{s:10:"song title";s:11:"test song 2";s:11:"song artist";s:13:"test artist 2";}} ) 

so far have tried access elements this:

foreach($my_playlist $item){     echo 'item: ' . $item[0] . '<br />'; } 

but outputs item: a

i output like:

song title: test song title song artist: test song artist

song title: test song 2 song artist: test artist 2

how access each element in array? also, type of array this? might me track down how access required items.

you have unserialize array:

$my_wake_playlist = unserialize($my_wake_playlist); 

and you'll have php array back.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -