does a string come before or after another

does a string come before or after another

am 20.01.2006 20:17:13 von laredotornado

Hello,

Given two strings, a and b, how would I determine if a is
alphabetically greater than or less than b? I'm using PHP 4.

Thanks, - Dave

Re: does a string come before or after another

am 20.01.2006 20:33:44 von Adam Plocher

Dave, you should be able to apply the greater than/less than operators
to a string:

$a = "fdsa";
$b = "asdf";

if ($a > $b)
{
echo "a is greater";
}
else
{
echo "b is greater";
}

// will echo "a is greater"