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

  • Home
  • SEARCH
  • 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 950839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:37:55+00:00 2026-05-15T23:37:55+00:00

i have an array, it have same data: data range 115X0101-115X0200 115X0101-115X0200 115X0101-115X0200 the

  • 0

i have an array, it have same data:

  data range    
115X0101-115X0200
115X0101-115X0200
115X0101-115X0200

the 115x mean production code..this unimportant.
we just concern at four digits behind it that we can counting.

1. i want script read or search "0101" and "0200" from 115X0101-115X0200
2. i have tried using regex to count them become 200-101=100
3. the "115X0101-115X0200" repeated until there are 20 data like this
4. after it reached 20, show result at page:
           data range
             100 
  • 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-15T23:37:56+00:00Added an answer on May 15, 2026 at 11:37 pm

    If this is the raw data, the easiest way to extract it is probably using a regular expression, as you’ve mentioned.

    You’ll probably want something like this (in PHP):

    # Get this from the database
    $sql_results = array(
        '115X0101-115X0200',
        '115X0101-115X0200',
        '115X0101-115X0200',
    );
    
    foreach($sql_results as $row)
    {
        preg_match_all('/\d{4}/', $row, $matches);
                    #200                     #101
        echo intval($matches[0][1]) - intval($matches[0][0]) + 1;
    }
    

    For each row, preg_match will find groups of 4 digits (\d{4}) and place them in $matches (use var_dump($matches) to see what it looks like).

    More on Regex

    • Regular Expressions Cheatsheet
    • Regular Expressions Help

    SQL Limit

    Side note: If you only want 20 results at a time, you’ll want to SELECT * FROM table LIMIT 20 when you query the database. To get rows 31-50 you’d use LIMIT 30, 20, which means offset by 30, then get 20 rows.

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

Sidebar

Related Questions

I have a list of numbers like $list = array(1,5,19,23,59,51,24) in actual code this
So I have a situation very similar to this (much simplified) code: import Data.Maybe
I have an array with lots of items with same names like CloudObserverCMSStub edited
I have three arrays, all the same size: xout % cell array xin %
I have 2 arrays of the same length like this: a = [12,21,21,13,13,13,13,31]; b
I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
I have array result like this: Array ( [0] => stdClass Object ( [id_global_info]
I have array of strings, String[] data and it's 10 elements has value P
Sitation: overview: I have something like this: std::vector<SomeType> values; std::vector<int> indexes; struct Range{ int
I have an array of IP addresses, and I want to send the same

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.