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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:36:31+00:00 2026-06-06T13:36:31+00:00

Sorry guys, not being lazy, I know others have had the same error message

  • 0

Sorry guys, not being lazy, I know others have had the same error message solved but I still couldn’t figure it out so I had to ask.

I have 2 2d arrays each with a string and a corresponding int.

I’m trying to compare the strings in the first array to the strings in the second and if they are the same, i want to add the corresponding integers together.

I am getting the error – “Cannot use a scalar value as an array” on the 7th line

for($countOne=0; $countOne<10; $countOne++)
    {
    for($countTwo=0; $countTwo<10; $countTwo++)
     {
       if($blekko_Array['url'][$countOne]==$bing_Array['url'][$countTwo])
       {
         $blekko_Array['score']['$countOne'] = $blekko_Array['score']['$countOne'] + $bing_Array['score']['$countTwo'];
        }
     }
    }

Anyone know what the problem is?

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-06T13:36:32+00:00Added an answer on June 6, 2026 at 1:36 pm

    This should do it:

    foreach ($blekko_Array as &$blekko) {
        foreach ($bing_Array as $bing) {
           if($blekko['url']==$bing['url']) {
               $blekko['score'] += $bing['score'];
           }
        }
    }
    

    For one thing, your code is hardwired to look through 10 items, so if your array has less than 10 entries, you’ll get errors on the missing ones.

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

Sidebar

Related Questions

guys sorry for being so noob but im still starting yet with my php,
Sorry guys, I'm a noob. I know that some languages support type casting, but
sorry for beeing a little lazy and not trying it all out myself, but
I could be not more sorry guys - the question was a very wrong
Hello guys sorry if the question looks stupid to you. i have 3 tables
Sorry for the wall of text guys but this one requires expliaining, way too
Sorry for a long question and not a very descriptive title, but my problem
OK, sorry for the overly broad question, but let's see what you guys suggest....
Sorry guys!My bad...I should have posted my main function though. I was implementing a
Sorry ... about this silly/stupid question, guys: Why aren't equals() and hashCode() being applied?

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.