Source Code:
(back to article)
<?php $string = "The quick brown fox jumps over the lazy dog."; $start = "quick"; $end = "fox"; $start_pos = strpos($string, $start); $end_pos = strpos($string, $end); $substring = substr($string, $start_pos, $end_pos - $start_pos + strlen($end)); echo $substring; // prints "quick brown fox"
Result:
Report an issue