$key) {
echo $i.' '.$key .'';
}
?>
Try using:
echo count($tags); // Output of 6
Arrays start with a key of 0, not one. So when using anything else apart from count, you will constantly get 1 less than your expected (unless you modify the array prior to counting)