Questions tagged [array-difference]

Used for questions concerning the difference between arrays. For example, where elements in two arrays differ from each other, or subtracting the content of one array from another. Since the tag can be broadly applied to any programming language that supports arrays, use use one or more additional tags in order to help identify the specific language the question relates.

An array is a data structure that encompasses a group of elements. When working with arrays there can be a requirement to determine the difference between two or more arrays, and this tag is for questions relating specifically to finding that difference.

The difference between arrays can be determined in a number of ways, including finding where elements within the array differ, and can include operations such as subtracting the contents of one array from another to produce an outcome.

273 questions
-3
votes
6 answers

PHP finding same record in array

I would like to detect same records and then change quantity of the one record and delete the others. For example, given the following array: 'Cart' => [ (int) 0 => [ 'size' => '38', 'code' => '5', 'qn' => (int) 1 ], …
-4
votes
1 answer

Remove elements from a flat array if found in a column of an array of objects

I have a one-dimensional array of values in one array and I need to filter it by a particular property/column in an array of objects. My input arrays are populated by the following code: $array_one =…
Behzad
  • 75
  • 1
  • 7
-4
votes
4 answers

PHP array_diff output

I am using array_diff correctly to compare 2 arrays. In documentation, it says the output is like this: Array ( [1] => blue ) As you can see, each output will come in a single line. But when I try it, it only shows me output in 1 line. Maybe…
Tárraga
  • 461
  • 1
  • 6
  • 13
1 2 3
18
19