Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
1 vote
2 answers
369 views

Lets say I have the following array: $array_1 = [ 'Green' => 'Tea', 'Apple' => 'Juice', 'Black' => 'Coffee', ]; How do I flip the key => value of ...
2 votes
1 answer
633 views

I am a beginner to programming and was trying how to learn to flip every alternate row in my 2-D array(python) For Example: `Input a=[[1,2,3,4,5], [10,9,8,7,6], [11,12,13,14,15], [...
1 vote
1 answer
2k views

Code used for processing form $_POST submissions is working well on most forms but suddenly broke on a new set of forms. I can't see any difference in the forms themselves as it's based purely on the ...
user avatar
2 votes
2 answers
439 views

I have an array like this: $files = array( "Input.txt" => "Randy", "Code.py" => "Stan", "Output.txt" => "Randy" ); I want to group the file by its owner and returned like this: [...
0 votes
2 answers
738 views

<?php // output headers so that the file is downloaded rather than displayed header('Content-type: text/csv'); header('Content-Disposition: attachment; filename="csv.csv"'); // do not ...
Rob's user avatar
  • 59
2 votes
2 answers
2k views

I'm trying to flip array but it missed value from the key with the same name. What do I have to use, to add couple values to key which occur multiple times in array? For example, for [ "Input....
0 votes
4 answers
1k views

I'm looking for a way to replace nested foreach loops with a functional programming approach. Here is the sample data: $mode[1] = [1, 2, 5, 6]; $mode[0] = [3, 4, 7, 8]; Currently my code is this: ...
-1 votes
4 answers
1k views

Simple one (but not solved yet): this is my array [ [ "role" => "admin", "name" => [ "Felipy", "Ivan", ], ], [ "role" => "user", "name" => [ "Michel", ...
0 votes
1 answer
1k views

This is my code. $param = array('email'); $this->getMapper()->copyfrom('POST',function($val) { return array_intersect_key($val, array_flip($param)); }); And I get the error in title ...
3 votes
2 answers
1k views

I have two arrays: $arr1 = array(101 => 250, 102 => 250, 103 => 250, 104 => 500, 105 => 500, 106 => 500,); and $arr2 = array(0 => 103, 1 => 104, 2 => 105) The result I ...
0 votes
2 answers
355 views

I have an array like this array(123=>'c', 125=>'b', 139=>'a', 124=>'c', 135=>'c', 159=>'b'); and I want to flip the key/values so that duplicate values become an index for an array. ...
tester2001's user avatar
  • 1,071
0 votes
5 answers
98 views

I wonder if someone can help me. I have an array which I need to group by 'Airport Retailer', 'Seaport Retailer', etc. Array ( [World Duty Free Group] => Airport Retailer [Duty Free ...
4 votes
2 answers
7k views

I have a little problem in php, which i find hard to explain in words. I have an associative array which contains key-value. I would like to make a function (or if there is already one) which would ...
4 votes
3 answers
2k views

I have a flat associative array which may contain duplicate values. Array ( [for-juniors] => product_category [for-men] => product_category [coats] => product_category [for-...
-4 votes
3 answers
3k views

I recently updated the server on which I work. I have got an error: "Warning: array_flip() expects parameter 1 to be array, null given in..." Does someone know how to fix it? Here is a ...

15 30 50 per page
1
2

AltStyle によって変換されたページ (->オリジナル) /