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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:17:49+00:00 2026-06-13T08:17:49+00:00

This is the problem: I have the following array (from $wpdb->get_results() ): array(6) {

  • 0

This is the problem:

I have the following array (from $wpdb->get_results()):

array(6) {
    [0]=> array(1) {
        [0]=> string(7) "1102006"
    }
    [1]=> array(1) {
        [0]=> string(7) "1102006"
    }
    [2]=> array(1) {
        [0]=> string(7) "8092007"
    }
    [3]=> array(1) {
        [0]=> string(8) "23062012"
    }
    [4]=> array(1) {
        [0]=> string(8) "29072000"
    }
    [5]=> array(1) {
        [0]=> string(8) "30082008"
    }
}

And I would like to find the lowest integer from 10,000 on that is NOT in this array. In this case the answer would be 10,000 as 10,000 is not in the array.

Thanks

  • 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-13T08:17:51+00:00Added an answer on June 13, 2026 at 8:17 am

    This is how I interpreted your question.

    Starting from 10000, find the first available number that is NOT within your data array.

    <?php
    
    $data = array(
        array('1102006'),
        array('1102006'),
        array('8092007'),
        array('23062012'),
        array('29072000'),
        array('30082008')
    );
    
    // flatten the array to a single dimension
    function flatten(&$v) { $v = $v[0]; }
    
    array_walk($data, 'flatten');
    
    // minimum number
    $num = 10000;
    
    // while a value has not been found
    while (!isset($value))
    {
        // check if the current number is in our data (exclusion list)
        if (array_search($num, $data) === false)
            $value = $num;
    
        // increment for our next search
        $num++;
    }
    
    echo $value;
    

    If you are just after the minimum value in that array, flatten the array in the previous answer and use min:

    echo min($data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on the following problem from this book . A certain
I have the following query: $select = $this->getDao()->select() ->from( array(new Zend_Db_Expr('FROM_UNIXTIME(expiration)')) ); The getDao
here is my problem I have the following array (for example) string[] arr =
Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {
Never thought I'd have this problem :) The following snippet of code works in
I have the following problem. I am making this website you can see in
Hello i have the following problem, I record a video using red5 like this:
Following up this question , I have a further problem - I have two
This is a code review question more then anything. I have the following problem:
I have a following problems with eclipse, when I installed ClearCase plugin from this

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.