Seems a bit obvious that you should take a deeper look at the documentation of PHP.
There is standards functions that can do a lot and help you save a lot of time.
You say that you've got a string but show an example with an array.
Assuming you really have a string in input you may try explode() function to explode it to an array of objects.
Then having a real Array in_array() function will do the job.
$resultString = "12 13 17 26";
$resultArray = explode(" ", $resultString);
if (in_array("13", $resultArray)) {
echo "found";
} else {
echo "not found";
}
in_array(). Sumoanand posted his first.