I think i'm using the syntax incorrectly


Posted on 16th Feb 2014 07:03 pm by admin

Hi Everyone!

I'm new to this forum and a newbie with PHP - I'm glad I found this site - I hope to learn a lot! For my first and hopefully one of few questions, lol..

I told my boss i'd help him out with making a script to sort a txt file he has with 92 pages of e-mail addresses into something organized. Before i work out how to check for duplicates, so on and so forth - I'm trying to do the basics. I realise this is wrong

Code: <?php
$emails=fopen('test.txt','r');
$newlist=fopen('test2.txt','a');
while(! feof($emails))
{
$newline=fgets($emails);

$newchar=fgetc($newline);


if ($newchar==" ")
fseek($newlist,0,seek_end);
else

{
$addy = fnmatch ("*@*.*",$newline);

fwrite($newlist,$addy);
}
}
?>


I'm just trying to get the script to store a line in the variable and then go by character until it hits a space and move down to the next line to write the next e-mail it finds - I think the sequence im searching for is also a bit off. I understand I will need a loop of some sort so all the char's in the $newline character are viewed, can someone please help me out - I feel i'm so close to doing this!

No comments posted yet

Your Answer:

Login to answer
337 Like 22 Dislike
Previous forums Next forums
Other forums

Sending an SMS Message with ASP.NET
Often times it may be a requirement for your web application to send an SMS message. Such examples w

Count
Getting the same count everytime

Code:
$visitquery = mysql_query("SELECT COUNT(*) FR

How to add advertisment on top of videos
Hello,
I was told that i should find the answer for this problem in this forums.
I searched a

Different payment methods with different cross company requirements in F110
We are implementing SAP in a company in the shipping industry. They have the following requirement:<

Grouping and sorting results
Please help with this query.

I have 2 tables in a database, countires and cities. states look

Javascript or not?
How many people prefer javascript/ajax sites? How many prefer the good old fashion straight php sit

Sessions work for me and not others?
I'm having a bit of bad luck with sessions. In the past they have worked fine for me, but this time

Lack of simpleXML Documentation
What is up with this.

Look at: http://www.php.net/manual/en/function.simplexml-load-file.php<

Printing issues with xMII 11.5
For some reason, we have one report (and only one) that is giving us fits when trying to print. The

Problem with coding MySQL query
I'm having heaps of trouble getting one of my PHP/MySQL queries to work for some reason (and the fun

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash