Jump to content

Need help in arrays.. Please


kucing

Recommended Posts

Dear friends,

I am alittle trap in this arrays stuff if you peeps could help me in this will be very greatfull..


here is the problem I am facing rite now..

$array = array (
  'Total Stock' =>
  array (
    0 => '26',
    1 => '14',
    2 => '9',
    3 => '22',
    4 => '2',
    5 => '13',
    6 => '27',
    7 => '19',
  ),
  'Pending Stock' =>
  array (
    5 => '11',
    6 => '6',
    7 => '21',
    10 => '24',
    11 => '25',
    12 => '23',
    13 => '8',
  ),
);

foreach ($array as $inarray => $enteries){

print_r($enteries);

}


In this array there are 2 groups so when i get the data it comes out like this ..

Array ( [0] => 26 [1] => 14 [2] => 9 [3] => 22 [4] => 2 [5] => 13 [6] => 27 [7] => 19 ) Array ( [5] => 11 [6] => 6 [7] => 21 [10] => 24 [11] => 25 [12] => 23 [13] => 8 )


But I want it to be like

Array ( [0] => 26 [1] => 14 [2] => 9 [3] => 22 [4] => 2 [5] => 13 [6] => 27 [7] => 19 [8] => 11 [9] => 6 [10] => 21 [11] => 24 [12] => 25 [13] => 23 [14] => 8 )


If there is a way please guide me..

Thanks,
Kucing Hunt
Link to comment
https://forums.phpfreaks.com/topic/30911-need-help-in-arrays-please/
Share on other sites

First I want to thanks thorpe for your kind help :)

This is a very usefull command and it works with no problem but.. actually in my case I have no idea what my users are gonna chose the group name..

Like it could be "New stocks" or "Old stocks"

and I really appreciate your time and help.

Regards,
K hunt

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.