will not match the line you pasted above, which was:
[new]
bla bla bla
[New] != [new]
If you don't care about the case, you can do a couple of things...
First thing, you can lowercase the $value so you know for sure that the case will match your term, and then make sure the term you are matching against is in lowercase:
if(strtolower($value) == "[new]")
Also, I would suggest using trim() on the value from the text file, just in case there are any rogue whitespace characters attached to the line. It will remove any extra spaces from the ends of the line (left and right side, not in between).
That should give you what you are looking for. If you want to make sure it is case-sensitive, then what you are doing now will work perfectly. The only thing I would add is the trim() statement. It may or may not be needed, but it is a painful little bug to find when it does become a problem.
Let me know if you have any other questions...
Barry
0
rvlokvenAuthor Commented:
Good solution and a lot of extra info, tnx alot :)
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
if($value == "[New]")
will not match the line you pasted above, which was:
[new]
bla bla bla
[New] != [new]
If you don't care about the case, you can do a couple of things...
First thing, you can lowercase the $value so you know for sure that the case will match your term, and then make sure the term you are matching against is in lowercase:
if(strtolower($value) == "[new]")
Also, I would suggest using trim() on the value from the text file, just in case there are any rogue whitespace characters attached to the line. It will remove any extra spaces from the ends of the line (left and right side, not in between).
if(trim(strtolower($value)
For documentation:
http://www.php.net/manual/en/function.strtolower.php
http://www.php.net/manual/en/function.trim.php
That should give you what you are looking for. If you want to make sure it is case-sensitive, then what you are doing now will work perfectly. The only thing I would add is the trim() statement. It may or may not be needed, but it is a painful little bug to find when it does become a problem.
Let me know if you have any other questions...
Barry