php - Parsing a string which I am not able to identify as Object or Array or Json -


i receiving array in response of request. , when print_r on it, getting array( [receiver] => {:email=>"email@domain.com"}).

i not able understand how can access value of ":email".

please help.

edit:

here var_dump of response.

array ( 'receiver' => '{:email=>"email@domain.com"}' ) 

thanks.

use regular expression email.

$arr = array('recebodor' => '{:email=>"someone@example.com"}');  $email = preg_replace('/{:email=>"([^"]+)"}/', '$1', $arr['recebodor']); echo $email; // someone@example.com 

explanation:

{:email=>    match "{:email=>" in string "([^"]+)"    character within double quotes }            match last "}" $1           replace text text found inside parentheses 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -