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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:47:50+00:00 2026-06-10T21:47:50+00:00

I have a multidimensional array. Format is below: Array ( [1] => 2012.09.04;01:00;NZD;ANZ Commodity

  • 0

I have a multidimensional array. Format is below:

Array
(
    [1] => 2012.09.04;01:00;NZD;ANZ Commodity Price;1;0.5%;;-0.5%;1346720400
    [2] => 2012.09.04;01:30;AUD;Current Account Balance;2;-11.80B;-12.2B;-14.90B;1346722200
    [3] => 2012.09.04;01:30;JPY;Labor Cash Earnings (YoY);2;-1.2%;-0.3%;-0.6%;1346722200
    [4] => 2012.09.04;04:30;AUD;RBA Interest Rate Decision;3;3.5%;3.5%;3.5%;1346733000
    [5] => 2012.09.04;05:45;CHF;Gross Domestic Product (YoY);3;0.5%;1.6%;2.0%;1346737500
)

Now I convert it using this function:

private function array_to_json($array) {    

    $arr_out = array();
    foreach ($array as &$r) {
       $arr_out[] = explode(";", $r);
    }
    unset($r);
    return $arr_out;
}

And get this result:

Array
(
    [0] => Array
        (
            [0] => 2012.09.04
            [1] => 01:00
            [2] => NZD
            [3] => ANZ Commodity Price
            [4] => 1
            [5] => 0.5%
            [6] => 
            [7] => -0.5%
            [8] => 1346720400
        )

    [1] => Array
        (
            [0] => 2012.09.04
            [1] => 01:30
            [2] => AUD
            [3] => Current Account Balance
            [4] => 2
            [5] => -11.80B
            [6] => -12.2B
            [7] => -14.90B
            [8] => 1346722200
        )

    [2] => Array
        (
            [0] => 2012.09.04
            [1] => 01:30
            [2] => JPY
            [3] => Labor Cash Earnings (YoY)
            [4] => 2
            [5] => -1.2%
            [6] => -0.3%
            [7] => -0.6%
            [8] => 1346722200
        )

    [3] => Array
        (
            [0] => 2012.09.04
            [1] => 04:30
            [2] => AUD
            [3] => RBA Interest Rate Decision
            [4] => 3
            [5] => 3.5%
            [6] => 3.5%
            [7] => 3.5%
            [8] => 1346733000
        )

    [4] => Array
        (
            [0] => 2012.09.04
            [1] => 05:45
            [2] => CHF
            [3] => Gross Domestic Product (YoY)
            [4] => 3
            [5] => 0.5%
            [6] => 1.6%
            [7] => 2.0%
            [8] => 1346737500
        )

    [5] => Array
        (
            [0] => 2012.09.04
            [1] => 05:45
            [2] => CHF
            [3] => Gross Domestic Product s.a. (QoQ)
            [4] => 2
            [5] => -0.1%
            [6] => 0.2%
            [7] => 0.7%
            [8] => 1346737500
        )
)

Where [8] is a timestamp.

How can I find the first upcoming event ([8]>time()) and return it’s value?
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-10T21:47:51+00:00Added an answer on June 10, 2026 at 9:47 pm

    You have to go through all of the [8] items and for each of them check if they are greater than time(). If so, then make an array of them. In the end, use a min function on this array to get the smallest number.

    code:

    $future = array();
    foreach($arr_out as $a)
        if ($a[8] > time())
            $future[] = $a[8];
    
    $nearest = min($future); //contains the first upcoming event
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multidimensional array of arrays (source below), where my keys and values
For example, I have multidimensional array as below: $array = array ( 0 =>
I have a multidimensional array. The code below outputs one entire column. <?php for
I have a string which represents a multidimensional array in the format: [[A, a],
I have a multidimensional array converted to JSON data in this format. [[null,null,null,null,null,null],[null,null,null,1,1,null],[null,null,null,null,1,1],[null,null,null,null,null,null],[null,null,null,null,null,null]] I
hi i have multidimensional array in php i want to remove an index from
I have a multidimensional array which I am looping through using a foreach loop.
I have a multidimensional array, I am interested in getting all the elements (one
I have an multidimensional array that looks like this: Array ( [0] => Array
I have a multidimensional array, and I would have multiple arrays within it. Some

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.