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

The Archive Base Latest Questions

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

Possible Duplicate: PHP – Why is a concatenated print_r printed out of order? the

  • 0

Possible Duplicate:
PHP – Why is a concatenated print_r printed out of order?

the following is a piece of code which has $input in the format of S:2:0;M:7:9;L:4:9;XL:6:0;XXL:6:9 these are parsed and stored into the 2d array .. by the following code

    $stock_data = explode(';', $input);
    foreach($stock_data as $value) {
        $value = explode(':', $value);

        if (!empty($value[0])) {

            $temp_size = $value[0];
            $stock[$value[0]] = array('winkel' => $value[1], 'distributeur' => $value[2]);

            fb('afetr array val = '.$temp_size.' = its val -|'. print_r($stock[$temp_size]['distributeur']).'|',FirePHP::INFO);
        }
    }

    return $stock;

the values in the print_r($stock[$temp_size]['distributeur'] or print_r($stock[$temp_size]['winkel'] is always 1, even if later i try to print_r the whole array $stock, all it has got is 1.

I was trying for print_r() to show the array as it should be, What is going wrong here.

  • 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-16T04:30:12+00:00Added an answer on June 16, 2026 at 4:30 am

    That’s because that’s what print_r returns. If you want it to return the string, add the 2nd parameter:

    print_r($stock[$temp_size]['distributeur'], true)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: php loop through associative arrays i have this piece of code which
Possible Duplicate: php headers already sent error I have attached my code which am
Possible Duplicate: php date compare PHP compare dates I have this code which permits
Possible Duplicate: PHP Math Precision The following php code outputs 7 but I expect
Possible Duplicate: PHP - reversed order in if statement Checking for null - what
Possible Duplicate: php loop through associative arrays i have a variable which prints an
Possible Duplicate: PHP htmlentities() on input before DB insert, instead of on output For
Possible Duplicate: PHP UML Generator I am trying to understand some php code that
Possible Duplicate: PHP: the ultimate clean/secure function I have got this code when I
Possible Duplicate: PHP code mkdir('images','0777') creates a folder with 411 permissions! Why? I am

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.