Forum Moderators: coopster
echo "<TEXTAREA name=\"comments\" rows=\"8\" cols=\"20\">$displaycall[9]
TheWord:</TEXTAREA>";
What is happening right now every time this updated it adds TheWord: over and over again. Any ideas how to check inside of the $displaycall[9] for TheWord:?
if ($displaycall['9'] contains TheWord:){
Echo this;
}else{
Echo TheWord;
}
Does that make sense? I am just not sure what 'contains' could mean.
if (!strpos($displaycall['9'], 'TheWord') === false) {
Echo this;
} else {
Echo TheWord;
}
The cool part is the PHP developers have come out with a case-insensitive version as well (stripos [php.net]) but it is available in PHP 5 CVS only right now. I didn't realize this until I received errors when I tried to use it the other day on a PHP 4.3.4 installation...bummer. I had to resort to the following workaround for case-insensitive:
$found = (stristr($haystack, 'needle') === false)? false : true;
Note: If you only want to determine if a particular needle occurs within haystack, use the faster and less memory intensive function strpos() instead.
I never noticed that and have been using strstr(). I think two minutes with grep will speed up a certain script that calls strstr() a lot.
Thanks coopster
Tom