anders2002
MIS
Hi,
I', trying to write a piece of code that reads a string and only outputs the information that sits before a space:
i.e.
"anders@dwl.co.uk Subject:"
would be outputted as
"anders@dwl.co.uk"
I need to do this as I am trying to strip email addresses from a large CSV file and have nearly cracked it but I just can't get it to display everything before a space is encountered?
Any ideas?
My code at the moment is like this:
$fp = fopen ("rejects.csv","r"
;
while ($data = fgetcsv ($fp, 1000, ","
) {
$emailarray = split("o:", $data[0]);
$output1 = substr($emailarray[1],0,60);
$output1 = trim($output1);
$output1 = strtok($output1," "
;
$output1 = strtok($output1," "
;
print $output1;
print "<hr>";
}
Thanks,
Anders
I', trying to write a piece of code that reads a string and only outputs the information that sits before a space:
i.e.
"anders@dwl.co.uk Subject:"
would be outputted as
"anders@dwl.co.uk"
I need to do this as I am trying to strip email addresses from a large CSV file and have nearly cracked it but I just can't get it to display everything before a space is encountered?
Any ideas?
My code at the moment is like this:
$fp = fopen ("rejects.csv","r"
while ($data = fgetcsv ($fp, 1000, ","
$emailarray = split("o:", $data[0]);
$output1 = substr($emailarray[1],0,60);
$output1 = trim($output1);
$output1 = strtok($output1," "
$output1 = strtok($output1," "
print $output1;
print "<hr>";
}
Thanks,
Anders