Questions tagged [unique-array]

unique multidimensional array

8 questions
1
vote
1 answer

String to Multidimensional Array with Unique value in PHP

I have below string and want to create multidimensional array using unique value $string =…
Bhumi Shah
  • 9,323
  • 7
  • 63
  • 104
0
votes
3 answers

Unique array with exception

I have really specific question. I spent many hours to make it work, but I wasn't successful. Here is piece of my code, how it looks now: var mainNames = ["James", "Robert", "John", "Michael", "William", "David", "Peter", "Joseph"]; var genNames =…
ReFresh
  • 5
  • 5
0
votes
2 answers

Trouble to understand why I can't have an array of objects with only unique object

I build an array over a loop, so each object in my array are build the same way with the same key and same data type. My array looks like this : $array_of_obj = array( 0 => { date: "2017-11-26" hour_array: Array [ "11:00:00",…
Mickaël Leger
  • 3,426
  • 2
  • 17
  • 36
0
votes
0 answers

Reorganizing range of data to calendar view (summarized by business week)

I am creating a custom "work schedule" planner within excel with various userforms and controls. In this workbook main sheet with all of the data looks like this: Task1 | Worker 1 | Supervisor 1 | Due Date 1(W) | Due Date 2(S) Task2 | Worker 2 |…
NewUser
  • 3
  • 2
0
votes
2 answers

php: array_unique missing a duplicate

I have been struggling with a minor issue with the array_unique for a couple of days now. Somehow the output always leaves the last duplicate in the array. I am getting the text from a text box in an html form $IDs = trim($_POST['IDs']); $IDs =…
rm65453
  • 81
  • 1
  • 8
0
votes
4 answers

I need to use a foreach loop on a json in php, but i only want to return unique values

I have parsed and decoded a json into a php file. The json is in a format similar to this: {"name":"John Doe", "records":[{"sample": "sample","fields":{"date":"Sample Date","Sample Field":"Sample value", "id": "sampleid"}} I have a lot of records…
Matt
  • 85
  • 7
0
votes
1 answer

in_array and array_unique not working

My code still displays the duplicate values, even after trying both functions in_array and array_unique. I get values from database. Some rows have multiple values. I want to break down those by commas and than remove duplicates. Please Help,…
-1
votes
2 answers

Counting unique values in an array (Java)

It's been asked before, I know, but I really don't know why my code isn't working. I'm trying to figure out how many unique values are in an undefined array. (i.e. {0, 0, 1, 1, 1, 5, 5, 6, 6, 7} should return a value of 5. This is what I have so…
Ulises Pico
  • 27
  • 1
  • 4