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 3451632
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:09:59+00:00 2026-05-18T09:09:59+00:00

I am trying to create a serial number checker. Serial Numbers are in ranges

  • 0

I am trying to create a serial number checker.

Serial Numbers are in ranges
A87594 – A92778
AB34534 – AC23405
B23933 – C344444

I was able to get the numbers to work using range() for the first serial number example, I’m guessing I need to use explode() but I wasn’t sure how to explode the letters into a variable and the numbers into a seperate variable.

if($_POST['submit']) {

    $snum = $_POST['serial_number'];

    // 1952
    $jan01_jan07 = range(87594, 92478);

    if (in_array($snum, $jan01_jan07)) {
        echo 'You have a 1952 Widget';
    }
    else {
        echo 'Your serial number is unknown';
    }
}
  • 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-05-18T09:09:59+00:00Added an answer on May 18, 2026 at 9:09 am

    You can try using strcmp, as it checks two strings, so you can check whether the incoming data is equal to or more than the lower bound and less than or equal to the upper bound, like this:

    $data = $_POST['data']; // change this accordingly
    
    if(strcmp($data, $lowerBound) >= 0 && strcmp($data, $upperBound) <= 0) {
        // successful match
    }
    

    As strcmp returns -1, 0, 1 if $data is before, the same as and after $lowerBound (dictionary ordered), so this works for strings as well.

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

Sidebar

Related Questions

We are trying to create a random number generator to create serial numbers for
I'm trying to create a serial number for my program. I'd like it to
I'm trying to create a moderately complex query with joins: SELECT `history`.`id`, `parts`.`type_id`, `serialized_parts`.`serial`,
I'm a rookie trying to search a text file for some serial numbers. I'm
I'm trying to hide some values in the registry (such as serial numbers) with
I'm trying to create a packet to send over serial using ruby-serialport. This seems
I am trying to create a generic Identifier class which I would be able
I'm trying to create a view with row numbers like so: create or replace
Hello I'm getting this error, while trying to save serial number to XML File.
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can

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.