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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:22:55+00:00 2026-06-13T06:22:55+00:00

I’m currently trying to get into foreach loops and I’m trying to get some

  • 0

I’m currently trying to get into foreach loops and I’m trying to get some stuff displayed from an API – The only problem is we have 3 development servers and some of the time when we are running the script it seems quite sluggish to display the information as it iterates through them, Im not too sure if its the script or the server and so I was just wondering if there would be any way to cleanup or make this script a little bit faster:

 foreach ($members as $member)
 {
      $level = $member['character']['level'];

      if($level==90)
      {
           $mname = $member['character']['name'];
           $character = $armory->getCharacter($mname);
           $gear = $character->getGear();
           $milevel = $gear['averageItemLevelEquipped'];
      }
 }

What we want it to do is get all the members names and then for each member to get the character information and then its gear also, I’d just like to check that, from what I’ve written, it’s only doing it once per member.

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-13T06:22:57+00:00Added an answer on June 13, 2026 at 6:22 am

    (Turning my comments into an answer for the appropriate checking, editing, comments, etc…)

    There’s nothing obviously wrong with the loop.

    First step is to profile the code to find what bit is slow, then you can figure out what to do about it.

    Here’s some speculation of may be causing it to be slow…

    • Network and/or database access to the WoW Armory.

    I presume this is talking to the WoW Armory which is going to involve network or database access for getCharacter or getGear which can seriously slow things down. That would be your most likely point of sluggishness. Consider caching their results, even if for a few minutes. This PHP WoW Armory project claims to do that for you, perhaps try that?

    • A lot of elements in $members.

    If you can ask your API for a list of members who are level 90, rather than iterating through them all yourself, that might be more efficient depending on how your API does that search.

    But profile first.

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

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.