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
Post a Comment