Breaking out of this while statement...
Posted: Wed Feb 04, 2004 8:33 pm
Okay I need to figure out how to break out of this while statement. I'm searching the file $comparefile for a duplicate link ($newlink). The script executes and then stops when $newlink != $word. But I need to be able to break out to send an error message when a match is found. Thanks.
Code: Select all
$fp = fopen("templates/links.txt", 'r');
$comparefile = fgets($fp);
$delims = """";
$word = strtok($comparefile, $delims);
while (is_string($word) && $newlink != $word ){
if ($word){
print "$word <br>";
//C an't figure out where to put this. print "Link has already been used.";
}
$word = strtok($delims);
}