Hi
how can i extract all the text inside the terms : “#star” and “#end”, ?
thank´s in advance
[code=php] <?php $var = "#star"; if(preg_match("#", $var)){ $new = preg_replace("#", "" , $var); }else{ echo("Does not contain a #"); } echo($var); ?> [/code]
[code=php] function find($start, $end, $string) { if(false !== ($pos = strpos(strtolower($string), strtolower($start)))) { if($remove = stristr(($cropped = substr($string, $pos + strlen($start))), $end)) { return trim(str_replace($remove, '', $cropped)); } } return false; } $string = "#start one text for test one text for test one text for test #end another text for test another text for test another text for test"; echo(find("#start", "#end", $string)); [/code]
Help @amrigo spread the word by sharing this article on Twitter...