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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:16:39+00:00 2026-06-10T00:16:39+00:00

I have two data here: The result of this first function: Array ( [2]

  • 0

I have two data here:

The result of this first function:

Array
(
[2] => Array
    (
        [SiteID] => 2
        [Balance] => 19000.00
        [MinBalance] => 100000.00
        [MaxBalance] => 1000000.00
        [OwnerAID] => 83
        [GroupID] => 1
    )

 [3] => Array
    (
        [SiteID] => 3
        [Balance] => 94000.99
        [MinBalance] => 100000.00
        [MaxBalance] => 500000.00
        [OwnerAID] => 17
        [GroupID] => 1
    )

[4] => Array
    (
        [SiteID] => 4
        [Balance] => 1000000.00
        [MinBalance] => 100000.00
        [MaxBalance] => 1000000.00
        [OwnerAID] => 12
        [GroupID] => 1
    )

)

The result of the second function:

 Array
(
 [3] => Array
    (
        [Deposit] => 459000
        [Reload] => 169100
        [Redemption] => 703576
    )

[2] => Array
    (
        [Deposit] => 1500
        [Reload] => 1000
        [Redemption] => 1000
    )
 )

Now, I need to bind the result of thie two functions, I try it with this codes:

    public function bindGHComponentsToSites()
    {
   error_reporting (E_ALL^ E_NOTICE);  
   $combine = array();

     foreach ($this->arrays as $keys => $data) {


       foreach($this->result as $keyss => $value){

            if($data['SiteID'] == $keyss){

                $merged = array_merge((array)$data, (array)$value);

            }
             else if ($data['SiteID'] != $keyss){

                 $val = array('Deposit'=>0, 'Reload'=>0, 'Redemption'=>0);

                 $merged = array_merge((array)$data, (array)$val);
             }

        }

              $this->combined[$data['SiteID']] = $merged;

     } 

      print_r($this->combined);
  }   

But, I got the wrong output, the condition was, If the SiteID of bindownertosites doesn’t match to the SiteId of Computeghcomponents then just print the value of the Deposit, Reload and Redemption should be equal to zero.

The Deposit, Reload and Redemption are all equal to zero which is wrong.Here’s should be the right result:

Array
(
[2] => Array
    (
        [SiteID] => 2
        [Balance] => 19000.00
        [MinBalance] => 100000.00
        [MaxBalance] => 1000000.00
        [OwnerAID] => 83
        [GroupID] => 1
        [Deposit] => 1500
        [Reload] => 1000
        [Redemption] => 1000
    )

[3] => Array
    (
        [SiteID] => 3
        [Balance] => 94000.99
        [MinBalance] => 100000.00
        [MaxBalance] => 500000.00
        [OwnerAID] => 17
        [GroupID] => 1
        [Deposit] => 459000
        [Reload] => 169100
        [Redemption] => 703576
    )

[4] => Array
    (
        [SiteID] => 3
        [Balance] => 94000.99
        [MinBalance] => 100000.00
        [MaxBalance] => 500000.00
        [OwnerAID] => 17
        [GroupID] => 1
        [Deposit] => 0
        [Reload] => 0
        [Redemption] => 0
    )
  )

Is it possible to have this kind of result? Please help me guys, I’ve been working with this almost one week, but I always got a wrong output. I appreciate to your response.I put everything here to make clarify those things.Kindly review my question before you answer. Please help me and guide me in proper way. Thank you in advance.

  • 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-10T00:16:40+00:00Added an answer on June 10, 2026 at 12:16 am

    The this will do what you expected, so simple

    Try

    foreach (array_keys($this->arrays) as $value) {
        $default = array('Deposit' => 0, 'Reload' => 0, 'Redemption' => 0);
        if (array_key_exists($value, $this->result)) {
            $temp = array_merge($this->arrays[$value], $this->result[$value]);
            $this->arrays[$value] = $temp;
        } else {
            $temp = array_merge($this->arrays[$value], $default);
            $this->arrays[$value] = $temp;
        }
    }
    print_r($this->arrays);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have data here: Array ( [3] => Array ( [SiteID] => 3 [Balance]
I have data here: Array ( [1] => Array ( [SiteID] => 1 [OwnerAID]
I have two data frames with two columns each. The first column is timestamps
i have two data tables with the same structure the first one has one
I have two functions named ChangeText() & ChangeColor(), the first function called ChangeText who
I have a data.frame with 20 columns. The first two are factors, and the
I have two tables, images and image_data and here is an example of my
I have two Data Centers, each one with replication factor 3. Will write with
I have two data sets in google app engine datastore. class First_Set(db.Model): start_time =
I have two data sets, each dataset contains the pixel values of an image.

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.