You often need to open and process a file for different tasks. php append file new line; new line in php not working; php textarea replace newline with br; php line break in echo; php print array new line . By Earnest Blick at Dec 12 2020. By signing up, you agree to our Terms of Use and Privacy Policy. write to file php new line. I modified your code, I think follows is what you need, and I also put comment, function below will keep adding new user, you can add condition that to check user exist. length If length is an int, writing will stop after length bytes have been written or the end of data is reached, whichever comes first. setting aside all the things that are wrong about storing plain passwords in plain files and using _GET for this type of operation (use _POST instead) ;-), How about you store it like this?