Solved

Test if string alphanumeric value higher or lower

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

808 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