| Welcome to WebmasterWorld Guest from 220.127.116.11 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|Simple php function|
expert help needed
I need a very simple piece of php code that does the following:
INPUT: a string - let's say $a
1. open a .txt file, check if the file already contains a line that equals $a and if so echo on the screen "contains $a"
2. if not, add $a to the end of the file on a new line
$string = '$a';
$file = file [uk2.php.net]('file.txt');
if (in_array [uk2.php.net]($string,$file))
$fp = fopen [uk3.php.net]('file.txt', 'ab');
Not tested, but should give you some pointers.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved