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: 
```
<?php
  $txt = 'text das text dss text good text text bad text';
  $search = 'good text';

  $pos = -1;

  $i = 0;

  while (isset($txt{$i})) {
    $j = 0;

    $wrong = false;

    while (isset($search{$j})) {
      if ($search{$j} != $txt{$i + $j}) {
        $wrong = true;

        break;
      }

      $j++;
    }

    if (!$wrong) {
      $pos = $i;

      break;
    }

    $i++;
  }

  echo 'Position: '.$pos; // in your case it will return position: 23
?>

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