$gender = $f_count++; doesn't make sense, there's no reason to change $gender. just $f_count++; by itself is enough.