Linked Questions

19 votes
6 answers
52k views

I have an associative array, however when I add values to it using the below function it seems to overwrite the same keys. Is there a way to have multiple of the same keys with different values? Or is ...
Steven's user avatar
  • 14.1k
1 vote
7 answers
5k views

I have an array of form: $records = array( array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'Doe', ), array( 'id' => 3245, '...
user2129794's user avatar
  • 2,428
1 vote
2 answers
456 views

I have a string: Fragrances, Beauty & Health (153) Skin Care (146) Make Up (10) Health Care & Instruments (1) Hair Care (1) I'm converting it into an array: $formatted = ...
eozzy's user avatar
  • 69.3k
1 vote
3 answers
73 views

a dynamic array sorted from database that have some of multi similar group id's and some different ones something like this : $sourcearray = array( array(id => 1 , value => 'text'), array(...
Jacob MC's user avatar
0 votes
4 answers
76 views

Consider I have associative array with same key values: $arr = {'MessageID' =>1 ,'MessageID' =>5 , 'MessageID' => 8}; Now I want every call to function foo() which will insert a new key ...
JavaSa's user avatar
  • 6,322
0 votes
1 answer
163 views

i want to reset the above as below. $_REQUEST['some_number'] => Array ( [0] => 1 [0_1] => 2 [0_2] => 3 [2] => 7 [2_1] => ...
mark rammmy's user avatar
  • 1,498
0 votes
3 answers
89 views

Could anyone let me know how can I allow duplicate keys in php array? I have already read all identical posts concerning this questions and it does not answer my question. In the following example, I ...
Mustapha Fersaoui's user avatar
-3 votes
1 answer
91 views

I have an array like $sele_itmid = Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 4 [4] => 4 ) $fltrd_serl_batch = Array ( [0] => SAL121 [1] => SAL122 [...
satish kilari's user avatar
-1 votes
1 answer
109 views

I coded this to get an array with all product in the order $sync_data = []; for ($i = 0; $i < count($request['product_id']); $i++) { $sync_data[$request->input('product_id')[$i]] = [...
Othmane Bouhenna's user avatar
0 votes
1 answer
59 views

I have an array $cat1 including cat1[0]=>16 and cat1[1]=>16. I also have this array: $url_vars = array('text'=>$event->properties['text'],'SearchResultPagerPage'=>$thenextpage); I ...
CRAIG's user avatar
  • 1,029