Solved

Test if string alphanumeric value higher or lower

Posted on 2010-08-16
1
372 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

813 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

14 Experts available now in Live!

Get 1:1 Help Now