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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:24:47+00:00 2026-06-02T05:24:47+00:00

Supposing a multidimensional associative array that, when printed as text with print_r() , creates

  • 0

Supposing a multidimensional associative array that, when printed as text with print_r(), creates a 470 KiB file. Is it reasonable to assume that the variable in question takes up half a MiB of server memory per instance if it is different for each user? Therefore if 1000 users hit the server at the same time almost half a GiB of memory will be consumed?

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-02T05:24:48+00:00Added an answer on June 2, 2026 at 5:24 am

    There is an excellent article on this topic at IBM:
    http://www.ibm.com/developerworks/opensource/library/os-php-v521/

    UPDATE

    The original page was taken down, for now the JP version is still there https://www.ibm.com/developerworks/jp/opensource/library/os-php-v521/

    Basic takeaways form it are that you can use memory_get_usage() to check how much memory your script currently occupies:

    // This is only an example, the numbers below will differ depending on your system
    echo memory_get_usage () "\ n";. // 36640
    $ A = str_repeat ( "Hello", 4242);
    echo memory_get_usage () "\ n";. // 57960
    unset ($ a);
    echo memory_get_usage () "\ n";. // 36744
    

    Also, you can check the peak memory usage of your script with memory_get_peak_usage().

    As an answer to your questions: print_r() is a representation of data which is bloated with text and formatting. The occupied memory itself will be less than the number of characters of print_r(). How much depends on the data. You should check it like in the example above.

    Whatever result you get, it will be for each user executing the script, so yes – if 1000 users are requesting it at the same time, you will need that memory.

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

Sidebar

Related Questions

Supposing I have a merge module that installs a file MyFile.txt to a certain
supposing that I have two tables with same 3 columns: ID (int, identity), text
Supposing I have a File f that represents a directory, then f.delete() will only
Supposing that I have a standard EAR file (and the source files that were
supposing that I have two labels with variables text. For example: label1.Text = foo;
Supposing that I have millions of user profiles, with hundreds of fields (name, gender,
MVC newbie question re binders. Supposing I have two strongly typed partial actions that
Supposing that memory is not an issue does targeting a 64 bit OS make
Supposing that I have a remote machine on which I'm an admin, and I
Knowing the multidimensional-array's shape of a vector, how can we convert it into a

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.