Sorting through a delimited string with PHP
<p>I am trying to create a script that checks if a certain value is in a comma delimited string, and if the value is present, it should return true else it should return false.</p>

<p>Basically, I am trying to check if a user has voted for a specific person before, and if so, they cannot vote again, if they have not, vote and then add their uid to the database.</p>

<p>I am using explode to get all the values into an array, but I am unsure about the checking function, I have a few ideas but this is quite an important script so I wanted to see if there is a better way of going about it.</p>

<pre><code>$test = "john,jack,tom";

$exploded = explode(",",$test);

$hostID = "john";

foreach($exploded as $one){
    if($one == $hostID){
        $return = TRUE;
    }else{
        $return = FALSE;
    };
};
</code></pre>

<p>Thanx in advance!</p>
