php - Get information between two strings -
i have following php string
$string = "hello world<br>- 8/7/2013<br>hello world";
so basically, need information between dash , space (-
) , closest line break tag. appreciated! looked hours haven't been successful. don't think preg_replace
either.
strpos
finds index of substring (optionally after specified index), so:
$start = strpos($string, '- ') + 2; $end = strpos($string, '<br>', $start); $part = substr($string, $start, $end - $start);
Comments
Post a Comment