I am trying to scrape some strings (colors in the example below) but can only manage to scrape the first string (blue):

```
<?php

   function extract_unit($string, $start, $end)
   {
      $pos = stripos($string, $start);

      $str = substr($string, $pos);

      $str_two = substr($str, strlen($start));

      $second_pos = stripos($str_two, $end);

      $str_three = substr($str_two, 0, $second_pos);

      $unit = trim($str_three); // remove whitespaces

      return $unit;
    }   

// example to extract the colors 

$text = '<p>this is the color blue</p><p>this is the color yellow</p><p>this is the color red</p>';
$unit = extract_unit($text, 'color', '</p>');

// Outputs: blue, but I need yellow and red as well!
echo $unit;
?>

```

The above works but only outputs: blue, but I need yellow and red as well!

```
 foreach( $unit as $item )
{
    echo $item.'<br />';
}

```

This did not work, any ideas? Thanks!