Need help with this code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
jaymoore_299
Forum Contributor
Posts: 128
Joined: Wed May 11, 2005 6:40 pm
Contact:

Need help with this code

Post by jaymoore_299 »

Code: Select all

$template2 = file('template.txt');
$numcount=0;
foreach ($template2 as $v1) {
print &quote;testing&quote;;
if ($v1==&quote;/##&quote;)
{
$key = $numcount;
print &quote;numcount is &quote;.$numcount;
break;
}
$numcount++;
}
I'm trying to find the line # of the first instance of "/##" that appears in the file template.txt.
In that file, I have a line like this
htmlcode
/##
code to be replaced
##/

I made sure there were no other instances of /## and ##/ other than in the middle of the file, and that there are no spaces before or after them.
However, with this code /## is never found and the end of file is reached.
I see a whole bunch of "testing" but not a single "numcount is.."
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

don't do double posts for the same problem.
Locked