How to strip non-alphanumeric characters, convert spaces to dashes, uppercase to lowercase in this context
<p>I am using the <a href="http://www.advancedcustomfields.com/" rel="nofollow">Advanced Custom Fields plugin</a>, which is very good.</p>

<p>I am trying to take the output of one of the fields I created and give it the "permalink treatment", that is strip out non-alphanumeric characters like slashes, convert uppercase to lowercase, and convert spaces to dashes.</p>

<p>Specifically I am wanting to do this with the checkbox field. I want to do this, because I want to use the outputted values as css class names.</p>

<p>Its output is called by this bit of PHP (modified slightly from the <a href="http://www.advancedcustomfields.com/docs/code-examples/" rel="nofollow">documented use</a>, see example #4):</p>

<pre><code>&lt;?php

$values = get_field('field_name');
if($values)
{

foreach($values as $value)
{
    echo ' ' . $value;
}

}

?&gt;
</code></pre>

<p>Which returns all of the checkbox values (5 - 10 in this case) separated by a space. I successfully got the values showing up as class names, but now I need a way to format them to actually work as class names.</p>

<p>How could I tweak this to work? I found this bit that seems to work for a sinlge string:</p>

<pre><code>function stripJunk($string){    
    $string = str_replace(" ","-", trim($string));         
    $string = preg_replace("/[^a-zA-Z0-9-]/","", $string);
    $string = strtolower($string);
    return $string;}
</code></pre>

<p>but in my case it's an array, and I don't know how to work with that. I'm pretty worthless when it comes to PHP, except for being able to tweak things a little bit without breaking it.</p>
