$banned = explode(" ", $stringofbannedusers); $i = 0; for ($i=0; $i<$banned-1; $i++) { print $banned[$i]; }