do you guys know how i can write stuff to a text file in my php area?

for e.g. to currently view my php stuff through webpage this is what i do:

http://localhost/<dir>/filename

or

http://<my-ip>/<dir>/filename

(e.g.: http://localhost/login.html)

i want to know how i can write to a file called Pyscho.txt, and then view this file on the web by, for.e.g

http://localhost/Pyscho.txt

any help would be greatly appreciated

ps: my pages and files are in the 'www' directory (this is where all php files are kept i think)