471,853 Members | 1,254 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

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 1386
"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
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.