Question: What i want to do is search for a text/words within a long text like:

```
$txt = 'text das text dss text good text text bad text';

```

and i want to search for `good text` in this `$txt` without using PHP functions like `stripos()` or others, i want to use just `for` in PHP and make minimum loops as possible.

How can i go through all the `$txt` searching for `good text` and getting what is after it?

Answer: 
Try this one and let me know...

```
$txt = "text das text dss text good text text bad text";
function search_string($word, $text){
 $parts = explode(" ", $text);
 $result = array();
 $word = strtolower($word);

 foreach($parts as $v){

  if(strpos(strtolower($v), $word) !== false){
   $result[] = $v;
  }
 }
 if(!empty($result)){
    return implode(", ", $result);
 }else{
    return "Not Found";
 }
}
echo search_string("text", $txt);

```
You can use `preg_match` here. do you want example related to this ?