I need to check if a particular numeric id is in a given string or comma separated values.
$myVal = 20;
String could contain just a single valu
You could use explode to split the string into an array. Something like:
$parts = explode(',', $str);
Then you could use in_array on that.
If you're reading a file, take a look at fgetcsv or str_getcsv.