[snip] > Also does anyone know how to insert a text on about the 4 or 5 line of a file using php? I can add text to the end of a file and to the beginning, but I'm not sure how to do it for specific lines. > [/snip]
Ok, I whipped of a quick set of code that I have not tested <?php $lineCounter = 0; if($theFile = fopen("yourfile.txt", "r+"){ while(!feof($theFile)){ $theLine = fgets($theFile); $lineCounter++ if($lineCounter == 4){ fputs($theFile, "the stuff you wish to add"); } } fclose($theFile); } ?> We used to do this thing with PERL many years ago for a very basic web article publishing script where we opened a template file and searched for comment lines and inserted the appropriate article information, which could be done as above. As I recall it took some fairly complex regex and many more lines of code, though I am sure it could be rewritten now. HTH! Peace ... Jay Growing old is mandatory, growing up is optional ***************************************************** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort & Conference Center * * New Braunfels, Texas * * Contact [EMAIL PROTECTED] * * * * Want to present a paper or workshop? Contact now! * ***************************************************** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php