简体   繁体   中英

Need help php array that i didnt know

I have this array:

Array ( 

  [_edit_last] => Array ( [0] => 1 ) 
  [mymail-campaigns] => Array ( 
     [0] => a:1:{i:379;a:3:s:4:"sent";b:1;s:9:"timestamp";i:1374085107;s:4:"open";i:1374085295;}}  
   )              

  [_edit_lock] => Array ( [0] => 1374095131:1 ) 

  [mymail-userdata] => Array ( 
    [0] => :a5:{s:9:"firstname";s:0:"";s:8:"lastname";s:0:"";s:17:"nombre-y-apellido";s:16:"**Fabrizio Di   Tata**";s:7:"celular";s:13:"**0261155890069**";s:5:"_meta";a:1:{s:2:"ip";s:0:"";}} )

)

And I need to get only the data in bold.

I know that i need to use a foreach, but is not the typical array that i know. Please help me.

The data in the array item is the result of a serialize() and can be expanded back to an array using unserialize()

serialize()

unserialize()

You're probably viewing this array on some text editor that hides the bold tag. could be html or something. have you tried viewing the array on a vim or notepad? Because in an array you don't get to do styling it should just be purely data unless it is explicitly placed there but as a delimited string.

Looks like a post meta data array generated by Wordpress.

If so, you can unserialize the data with the help of the built-in get_post_meta() function.

example:

$array = get_post_meta($post->ID, 'mymail-userdata', true);

Reference with examples here: http://codex.wordpress.org/Function_Reference/get_post_meta

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM