I have a variable holding values separated by a comma (Implode), and I\'m trying to get the total count of the values in that variable. However. count() is just returning 1.
$schools = $_SESSION['sarray']; $array = explode(',', $schools); array_walk($array, 'trim'); $count = count($array);
The array_walk($array, 'trim') will remove any trailing space in elements value. :)
array_walk($array, 'trim')