A simple preg_match()
call using wordboundaries around a numeric character class will be completely accurate and suitable for your task.
The word boundary metacharacters ensure that full-integer matching is executed -- no false positive (partial) matching occurs.
Code: (Demo)
$array = array(
'text 1 2 and 3 text',
'text 3 9 25 text',
'text 9 25 48 text',
);
foreach ($array as $color) {
echo "\n---\n$color";
echo "\n\t" , preg_match('~\b[1-8]\b~', $color, $out) ? "checked (satisfied by {$out[0]})" : 'not found';
echo "\n\tChad says: " , (strpos($color,'1') || strpos($color,'2') || strpos($color,'3') || strpos($color,'4') || strpos($color,'5') || strpos($color,'6') || strpos($color,'7') || strpos($color,'8') ? 'found' : 'not found');
}
Output:
---
text 1 2 and 3 text
checked (satisfied by 1)
Chad says: found
---
text 3 9 25 text
checked (satisfied by 3)
Chad says: found
---
text 9 25 48 text
not found
Chad says: found
As for how to implement this technique in your script...
if (!preg_match('~\b[1-8]\b~', $color)) {
echo 'checked';
}