Converting comma separated integer/ digit values to an array of integers
OK here is the code to convert a comma separated string of integer/ digit value to an array
$csvintegers='1,2,3,4,7';
$listvals=split(",",$csvintegers);
?>
You can always compare whether if an integer is present in a string or not. The code to do so is
<? if (in_array(1,$listvals)) { ?>
1 exists<br/>
<? }?>
<? if (in_array(9,$listvals)) { ?>
9 exists<br/>
<? }?>
So the above code after running one after another, will output
1 exists
So basically this code
<? if (in_array(1,$listvals)) { ?>
checks whether 1 is in the array $listvals. $listvals was created by splitting (using PHP split() function ) the comma separated string of integers ($csvintegers) with respect to commas.















