kucing Posted December 16, 2006 Share Posted December 16, 2006 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 Quote Link to comment Share on other sites More sharing options...
trq Posted December 16, 2006 Share Posted December 16, 2006 You'll want to use [url=http://php.net/array_merge]array_merge[/url], something like....[code]<?php $newarray = array_merge($array['Total Stock'],$array['Pending Stock']);?>[/code] Quote Link to comment Share on other sites More sharing options...
kucing Posted December 16, 2006 Author Share Posted December 16, 2006 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 Quote Link to comment Share on other sites More sharing options...
trq Posted December 16, 2006 Share Posted December 16, 2006 [code]<?php $newarray = array_merge($array[0],$array[1]);?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.