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

The Archive Base Latest Questions

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

I have a class that is building some HTML using data stored in an

  • 0

I have a class that is building some HTML using data stored in an array. There are around 100 items in this array. Each item includes information like company name, a description, and flags for the different programming languages the company supports. I am doing string concatenation as I build the HTML for each item.

I have noticed that performance suddenly takes a huge hit when I append the programming language data. I see the page rendering timer jump from 0.15 secs to ~0.60 secs. This time includes grabbing the same data from the database each time. I can consistently get the performance to jump between these 2 times but commenting/uncommenting the following line of code:

$html .= '<div class="programmingLanguages"><strong>Programming Languages</strong> '.implode(', ', $progLanguagesArray).'</div>';

I’ve also been able to get the same performance drop by appending a long test string, something like this:

$html .= 'testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest';

What’s especially bizarre is that I have another line of code that uses the same ‘implode’ function and does NOT make any significant difference in performance:

$html .= '<div class="integrationMethods"><strong>Integration Methods:</strong> '.implode(', ', $intMethodsArray).'</div>';

Does anybody have any insight into what might be going on here? I am doing tons of concatenation like this elsewhere in my code and haven’t seen anything like this before. At this point, I’m stumped.

Here’s the full class:

class DeveloperView {

public static function getHtml($developers) {
    $html = '';
    $html .= '<div>';
    $html .= '<div>';

    $count = 0;
    foreach ($developers as $developer) {
        $url = $developer['attributes']['url'];
        $phone = $developer['attributes']['phone'];
        $company = $developer['attributes']['desc'];
        $active = $developer['attributes']['active'];
        $desc = $developer['object_value'];

        $intMethodsArray = array();
        if ($developer['attributes']['m1']) { $intMethodsArray[] = 'method 1'; }
        if ($developer['attributes']['m2']) { $intMethodsArray[] = 'method 2'; }
        if ($developer['attributes']['m3']) { $intMethodsArray[] = 'method 3'; }
        if ($developer['attributes']['m4']) { $intMethodsArray[] = 'method 4'; }
        if ($developer['attributes']['m5'])     { $intMethodsArray[] = 'method 5'; }

        $progLanguagesArray = array();
        if ($developer['attributes']['dotnet']) { $progLanguagesArray[] = '.Net (C# or VB.Net)'; }
        if ($developer['attributes']['asp'])    { $progLanguagesArray[] = 'Classic ASP'; }
        if ($developer['attributes']['cf'])     { $progLanguagesArray[] = 'Cold Fusion'; }
        if ($developer['attributes']['java'])   { $progLanguagesArray[] = 'Java'; }
        if ($developer['attributes']['php'])    { $progLanguagesArray[] = 'PHP'; }
        if ($developer['attributes']['perl'])   { $progLanguagesArray[] = 'Perl'; }
        if ($developer['attributes']['other'])  { $progLanguagesArray[] = 'Other'; }

        $html .= '<div class="';
        if ($count % 2 == 0) {
            $html .= 'listingalt';
        } else {
            $html .= 'listing';
        }
        $html .= '">';

        $html .= '<div class="developerPhone">'.$phone.'</div>';
        $html .= '<a class="ext_link" target="_blank" href="'.$url.'">'.$company.'</a>';

        $html .= '<div>';
        if (!empty($intMethodsArray)) {
            $html .= '<div class="integrationMethods"><strong>Integration Methods:</strong> '.implode(', ', $intMethodsArray).'</div>';
        }

        if (!empty($progLanguagesArray)) {
            $html .= '<div class="programmingLanguages"><strong>Programming Languages</strong> '.implode(', ', $progLanguagesArray).'</div>';
        }

        $html .= '</div>';

        $html .= '<p>'.$desc.'</p>';

        $html .= '</div>'."\n";

        $count++;
    }

    $html .= '</div></div>';

    return $html;
}

}
  • 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-10T13:16:01+00:00Added an answer on June 10, 2026 at 1:16 pm

    Now that I can provide an answer, I’ll just post my follow-up comment as the ‘answer’…

    I did indeed have a ‘bug’ in my timer, in that it was calculating the end processing time AFTER the echo of the HTML. So the amount of data being sent to the browser was effecting the processing time, where I was expecting to see the time spent processing BEFORE transmitting any data.

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

Sidebar

Related Questions

I have class that looks like this: class A { public: class variables_map vm
I have a class that I instantiate to save or load xml data. For
I have a class that gets a movieClip and then using addChild adds it
First some background: I already have a Result class that I've implemented to carry
I have an issue that's been bugging me this morning. I'm building an ASP.NET
I have the following class that maps some run loop calls from native code
I have an Entity class that I have extended using the partial class syntax
I have some code in HTML and CSS where HTML looks like this: <div
I'm building a website using HTML 5 markup, but have hit a problem regarding
I have a PHP class for building HTML tags. Each HTML tag becomes of

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.