Solved

Test if string alphanumeric value higher or lower

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

759 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

21 Experts available now in Live!

Get 1:1 Help Now