Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7817393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:13:07+00:00 2026-06-02T06:13:07+00:00

I need to compare two version #’s to see if one is greater than

  • 0

I need to compare two version #’s to see if one is greater than the other and am having a really hard time doing so.

version 1: test_V10.1.0.a.1@example
version 2: test_V9.7.0_LS@example

I’ve tried stripping all non numeric characters out so I would be left with:

version1: 10101
version2: 970

Which drops the ‘a’ from 10.1.0.a.1 so that’s no good, and I’ve tried taking everything between ‘test_’ and ‘@’ then stripping out anything to the right of an underscore ‘_’ and the underscore itself, but then I still have to strip out the ‘V’ at the beginning of the string.

Even if I can get down to just 10.1.0.a.1 and 9.7.0, how can I compare these two? How can I know if 10.1.0.a.1 is greater than 9.7.0? If I strip the decimals out I’m still left with a non numeric character in 1010a1, but I need that character in case say the release version I’m comparing this to is 10.1.0.b.1, this would be greater than 10.1.0.a.1.

This is driving me nuts, has anyone dealt with this before? How did you compare the values? I’m using php.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:13:08+00:00Added an answer on June 2, 2026 at 6:13 am

    I think you want to consider working with a regex to parse out the “number” part of the version numbers – “10.1.0.a.1” and “9.7.0”. After that, you can split by ‘.’ to get two “version arrays”.

    With the version arrays, you pop elements off them until you find a higher number. Whichever array it came from is the higher version number. If either array runs out, it’s a lesser version number (unless all the remaining elements are “0” or “a” or whatever semantics you use to say “base version”, e.g., “10.0.0.a.0” == “10.0”). If both run out at the same time, then they’re equal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to compare two bitmaps. One bitmap is loaded from a file, the
When you need to compare two tables to see what the differences are, are
in bash I need to compare two float numbers, one which I define in
I need to compare two row with each other and then write the fields
Well i want to compare 2 strings (version one and version two) and get
I need to compare two columns in a sql table. The data in one
I need to compare two dates using the Oracle decode function to see if
I need to compare two Date s (e.g. date1 and date2 ) and come
Note: Near complete beginner to logic programming I need to compare two lists of
could anyone assist me with this. I need to compare two beefy xml files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.