php - Capture text between two strings -
i'm trying capture string in text field , between 2 other strings.
- start string: {"website":"
- end string: ","referrer":"
the complete string this:
- {"website":"www.domain.com","referrer":"invited on google+"}
- or:
- {"website":"www.anotherdomain.com","referrer":""}
- or perhaps:
- {"website":"www.about.me/subdomain","referrer":""}
i need capture between start , end string , have been trying various string methods mixed results.
the start , end string same.
any suggestions...?
that called json array , can converted in php array json_decode function.
$json = '{"website":"www.domain.com","referrer":"invited on google+"}'; $info_array = json_decode($json, true); echo $info_array['website'];
you not need preg_match, string split or other stuff.
Comments
Post a Comment