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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:22:14+00:00 2026-06-06T17:22:14+00:00

I got the following array (shortened … multiple dot mean that they are data

  • 0

I got the following array (shortened … multiple dot mean that they are data there, both array start at entry 1 until the end.

Array
(
    [12U_S_136_15_29_141] => Array
        (
            .....

            [35] => Array
                (
                    [stop_sequence] => 35
                    [stop_id] => 1601394
                )

            .....

            [46] => Array
                (
                    [stop_sequence] => 46
                    [stop_id] => 122052
                )

            [47] => Array
                (
                    [stop_sequence] => 47
                    [stop_id] => 136208
                )

            [48] => Array
                (
                    [stop_sequence] => 48
                    [stop_id] => 128163
                )

        )

    [12U_S_141_57_6_141] => Array
        (
            [1] => Array
                (
                    [stop_sequence] => 1
                    [stop_id] => 1601394
                )

            .....

            [12] => Array
                (
                    [stop_sequence] => 12
                    [stop_id] => 122052
                )

            [13] => Array
                (
                    [stop_sequence] => 13
                    [stop_id] => 136208
                )

            [14] => Array
                (
                    [stop_sequence] => 14
                    [stop_id] => 128163
                )

        )

)

As you can see, both array end are equal… 35 = 1, 46 = 12, …, 48 = 14. By equal, I mean the same stop_id but will always be diffrent for stop_sequence and of course the array entry number.

I want to know how I can compare the entire array against the other so I can know if, here let’s say, the second array match the first one at 100% (except we don’t look for stop_sequence so this can be different. So in this case, both will be mark as “equal”, but if let’s say the last entry had a different stop_id (entry 48 would be != from the entry 14), the array will be mark as “not equal”.

Anyone have a path to lead me ? I keep thinking but do not know how. I’ve tryed array_compare but this leaded to nothing :\

Thanks

EDIT
Nothing can be change to the database. Also, the array need to be created this way (with weird text, ie 12U_S_136_15_29_141). I can do whatever in 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-06T17:22:18+00:00Added an answer on June 6, 2026 at 5:22 pm

    fetch the stop_id in to new array:s and compare thous

    here is a useful function

        function sub_array($array, $sub_key)
        {
                $new_array = array();
                if(is_array($array) AND $array)
                {
                        foreach($array as $key => $data)
                        {
                                $new_array[$key] = $data[$sub_key];
                        }
                }
                return $new_array;
        }
    

    then just compare the arrays

    if(sub_array($a['12U_S_136_15_29_141'], 'stop_id') == sub_array($a['12U_S_141_57_6_141'], 'stop_id'))
    

    or if you know what stop_id that matches:

    $first_stop_id_list = sub_array($a['12U_S_136_15_29_141'], 'stop_id');
    $secound_stop_id_list = sub_array($a['12U_S_141_57_6_141'], 'stop_id');
    $matches = array_intersect($first_stop_id_list, $secound_stop_id_list);
    
    if(!$matches)
       echo "No stop_id matches";
    else if($first_stop_id_list = $secound_stop_id_list)
       echo "all element was in both";
    else if($matches == $first_stop_id_list)
       echo "all element in first was in secound";
    else if($matches == $secound_stop_id_list)
       echo "all element in secound was in first";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I've got the following situation: $do = mysql_query($sql); return array(data=>array(mysql_fetch_object($do)), rows=>mysql_affected_rows()); Which is
I've got the following example: type Stream (capacity) = let data = Array.zeroCreate capacity
I've got the following less code. I've read around that there is a limitation
I got following repeating syntax and I want to keep all <h1> that is
I've got following problem: (c#) There is some class (IRC bot), which has method,
I have got the following array. Array ( [1] => a [2] => b
I've got the following global array... public static float camObjCoord[] = new float[8000]; I've
I've got the following float array public static float camObjCoord[] = new float[8000]; declared
Hey Guys, I've got the following float array... public static float camObjCoord[] = new
I've got an array that uses UNIX timestamps for array keys. The array will

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.