Solved

Test if string alphanumeric value higher or lower

Posted on 2010-08-16
1
370 Views
Last Modified: 2012-05-10
How can I compare two strings against each other for alphanumeric sorting?
if ('abc' < 'xyz') echo 'The first item should rank higher than the second item when sorted alphanumericly';

Open in new window

0
Comment
Question by:hankknight
1 Comment
 
LVL 3

Accepted Solution

by:
mahadazad earned 500 total points
ID: 33450673
$str1 = 'abc';
$str2 = 'xyz';

if (strcmp(strtolower($str1),strtolower($str2)) < 0) {
    echo 'The first item should be rank higher than the second item when sorted alphanumericaly.';
}
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now