0

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.

  • we need more data examples. There are too many ways, depending on what kind of possible data you can get, to properly parse and extract those particular strings. For example, is the key ALWAYS 'mymail-userdata' or does it not matter? Does the value ALWAYS have "nombre-y-appellido"? I need to know what to expect and what never to expect. – Lochemage Jul 17 '13 at 22:42
  • http://stackoverflow.com/questions/8641889/how-to-use-php-serialize-and-unserialize – zod Jul 17 '13 at 22:46
  • The data EDIT should be reversed, data in bold is from `s:16` and `s:13`. The OP simply needs to use `SUBSTR` here. – Chibueze Opata Jul 17 '13 at 22:55
  • Side note: It's ok to paste code examples, but please take care about privacy. In your code there is sensitive data like name, phone number, etc and you are putting it straight into public domain. – null Jul 17 '13 at 23:22

2 Answers2

2

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

serialize()

unserialize()

RiggsFolly
  • 89,708
  • 20
  • 100
  • 143
0

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.