This function allows you to delete lines of text from a file. Great for editing small .txt files if you don't want to open your FTP! (call me lazy but thats what I use it for!)
By : DeadlySin3
<html> <head> <title>removing lines from a file</title> </head>
<body>
<?php
// this function strips a specific line from a file // if no linenumber is specified, last line is stripped // if a line is stripped, functions returns True else false // // e.g. // cutline('foo.txt'); // strip last line // cutline('foo.txt',1); // strip first line
/* its probably a good idea to allow access to this file via a password. otherwise, anyone that knows its in your directory could delete lines of text from the file you specify below! */
cutline('foo.txt',6); // deletes line 6 in foo.txt } ?>
</body> </html>
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.