Chris W. Parker wrote:
Russ mailto:[EMAIL PROTECTED]
on Wednesday, March 30, 2005 1:18 PM said:
I'm new to php and linux. I am trying to replace a password program I
used under windows with a mysql based login. I want to compare the
first character of the first and last name of the user for a capital
letter.
Why? What does that accomplish?
?php
$fname=John;
$lname=Smith;
Where's the quotes?
if(strncmp(S,${lname},1) ===0) {
?
h1strncmp() must have returned returned non-false/h1
non-false = true
?php
} else {
h3Strncmp() must have returned false/h3
?php
}
?
Rewrite:
?php
$fname = John;
$lname = Smith;
if(preg_match(/[A-Z]/, substr($fname ,0 ,1)))
{
echo first letter is uppercase.;
}
else
{
echo first letter is not uppercase;
}
?
There might be a better way than a regex but that's the first thing that
came to my mind.
HTH,
Chris.
Thanks Chris, I'll try that. I'm not really a programmer, done a little and
trying to learn as I go. I had quotes at one point but took them out tring
to get it to work.
--
Russ
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php