View Full Version : How to make function to read TXT file and modify?

03-21-2009, 08:44 PM
I would like to read file on server's folder and modify LIST
with convert to Lowercase and Uppercase and first letters to Uppercase.

As there will be many functions of modification how to do with functions for each modification?

03-22-2009, 01:57 AM
Okay, unfortunately I had trouble understanding your post so this may not be what you're looking for.

You will need:
fopen(); - Opens file or URL (http://us3.php.net/manual/en/function.fopen.php)
fclose(); - Closes an open file pointer (http://us3.php.net/manual/en/function.fclose.php)
strtoupper(); - Makes an entire string uppercase (http://us3.php.net/manual/en/function.strtoupper.php)
strtolower(); - Makes an entire string lowercase (http://us3.php.net/manual/en/function.strtolower.php)
ucfirst(); - Makes the first character in a string uppercase (http://us3.php.net/manual/en/function.ucfirst.php)
lcfirst(); - Makes the first character in a string lowercase (http://us3.php.net/manual/en/function.lcfirst.php)

Be sure to check out the examples given for all of these functions so you can see how to utilize them.

Using the above functions you'll be able to create a script that opens a file, and, using a loop in conjunction with the above string functions, performs your modifications.