Just substitute strstr() with stristr()
The extra I in stristr() stands for Insensitive.
If I was insensitive, I would say RTFM :)
If you look under http://www.php.net/manual/en/function.strstr.php
It tells you about stristr
[TK]
-Original Message-
From: jtjohnston [mailto:[EMAIL
I need to make this case insensitive. This seems like over kill?
if((substr($author, 0, 1) == a) or (substr($author, 0, 1) == a))
{
}
if((strtolower(substr($author, 0, 1)) == a)
{
}
:)
J
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
if (eregi(^a, $author))
{
print blah!;
}
Niklas
-Original Message-
From: jtjohnston [mailto:[EMAIL PROTECTED]]
Sent: 5. maaliskuuta 2002 8:08
To: [EMAIL PROTECTED]
Subject: [PHP] case insenstive
I need to make this case insensitive. This seems like over kill?
Use strtolower() or strtoupper() to change the case of a string.
And yes doing the same thing twice in the same statement is overkill! :)
if((substr(strtolower($author), 0, 1) == a) ||
(substr(strtolower($author), 0, 1) == a)){}
- Original Message -
From: jtjohnston [EMAIL PROTECTED]
if ($author[0]=='a' || $author[0]=='A')
{
}
or (much slower)
if (strtolower($author[0])=='a')
{
}
--
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp
5 matches
Mail list logo