Ok - to go over this for the 100th time (and I havent been posting to this board very long)....
We are not here to write all your damn code for you!!!!!!!!! Please don't come along and ask people here to produce code for you - this is a HELP forum - not a "damn - help me, I really need a program that will go off and make the tea, and let me know when I have mail, and do my shopping".
To help you get started on your great trip of finding out how to do stuff for yourself, let me guide you to some ways to do it.
1, Goto php.net. This is THE resource for PHP on the net. As they say again and again RTFM. This has the added bonus of comments attached to function pages.
2, In particular look for File functions. You can open, read, write to files as required.
3, In particular look at "file" function. This lets you read file contents into an array.
4, The next step after readin in would be to split up the line. Try some regular expressions if you are really brave (I wouldn't recommend this for a newbie though), or try a function like "explode" which will split a string (such as fred:bob:steve) on a set delimiter (i.e. ":") and return these elements in an array.
5, Think about how you would do this in reverse to save them back out.
I hope you enjoy your journey of discovery. I am enjoying mine and still look forward to each new challenge, it's fun when you can do it yourself 🙂