When you are splitting and joining strings you can often end up with unwanted special characters such as spaces, tabs or line returns. In stringjoin.php there is a simulated example. Save that file as stringtrim.php.
Note that it reports the password length as 9 rather than 8 because there is a space at the end. It is surprisingly common for users to accidentally add that space at the end so add this code under the line which sets the value of $password:
Try it and the password should now be reported correctly. The trim() function removes any invisible characters at the beginning or end of a string. You will use trim again soon.