469,282 Members | 1,822 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

what is the easiest way to compare strings for alphabeticalness?

Can I check alphabeticallness as easily as

"aaa" "bgeoid"

?

$var1 = "cccccc";
$var2 = "f";

if ($var1 $var2) {
// do something here
}
Is this a reliable way to check strings, or will I get tripped up in
some situations?

Nov 17 '06 #1
1 1252
"lawrence k" <lk******@geocities.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Can I check alphabeticallness as easily as

"aaa" "bgeoid"

?

$var1 = "cccccc";
$var2 = "f";

if ($var1 $var2) {
// do something here
}
Is this a reliable way to check strings, or will I get tripped up in
some situations?
Try the strcmp function.
http://fi.php.net/manual/en/function.strcmp.php

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi.net | rot13(xv***@bhgbyrzcv.arg)
Nov 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by J.W. | last post: by
11 posts views Thread by Nobody | last post: by
19 posts views Thread by David zhu | last post: by
4 posts views Thread by Sasidhar Parvatham | last post: by
14 posts views Thread by Samuel R. Neff | last post: by
2 posts views Thread by Roger Twomey | last post: by
3 posts views Thread by Twinkle | last post: by
3 posts views Thread by whisher | last post: by
2 posts views Thread by Peter Proost | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.