Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
77 views

I am getting a list categories names based on which tag is selected in WordPress, the code all works and returns a list of categories but I can't get the code to stop the duplicate category names. ...
Craig's user avatar
  • 195
0 votes
1 answer
76 views

I am revising the question I asked before that was not clear at all. I am very much new to PHP programming. I have a table in postgres: | gene_name | description| | gene1 | kuku | | gene1 ...
Alex's user avatar
  • 31
1 vote
0 answers
41 views

i have two tables, one separates tags by comma, the other converts similar tags to single tags. example: The exploded tags table I got in the database: <?php foreach ($result as $row) { ...
Şerif Arat's user avatar
-1 votes
1 answer
38 views

My function store elements in an array like this: array ( 0 => array ( 'name' => 'Roger', 'id' => '1', ), 1 => array ( 'name' => 'David', 'id' => '2', ),...
SOUserNumber613's user avatar
0 votes
2 answers
66 views

I am trying to create an array where I need to filter with a certain key (fileid) so that it returns only unique keys for parent array. Here is what I have.. Array ( [ABCD] => Array ( ...
Abhik's user avatar
  • 674
0 votes
1 answer
51 views

I have this array with certain brand_ids, within these brands I have an array of dates in which a sale occured but these are based on the products in sale so they may appear multiple times on the same ...
user avatar
1 vote
2 answers
1k views

I want delete duplicate array from two arrays, but just show one of array, how I can do it ? I want result [1, 4] const arr1 = [1, 2, 3, 4]; const arr2 = [2, 3, 5, 6] function arrayUniq(arr1, arr2) { ...
mazbeib's user avatar
  • 11
-1 votes
2 answers
121 views

I have been racking my head trying to think if there is a simpler method to grabbing the unique objects out of an array, but can't find any documentation or confirmation that anything exists that will ...
Zak's user avatar
  • 7,581
0 votes
2 answers
138 views

Using PHP, I have an array like this: Array 1 [ {epid: "123", hash: "xxxxxx"}, {epid: "456", hash: "xxxxxx"}, {epid: "789", hash: "xxxxxx&...
Keith Petrillo's user avatar
1 vote
0 answers
170 views

Merge a multi-dimensional array to the custom array as required. Need the solution in PHP (using in Laravel-8). Custom array is needed to make rows for creating an excel file using Spreadsheet. This ...
Vaibhav Jain's user avatar
-1 votes
2 answers
906 views

I have a fairly complex MySQL call that results in simple output something like this; name timestamp comm1 comm2 counter Bill 2021-04-18 19:31:00 data data 1 Bill 2021-04-18 19:32:...
Keith D Kaiser's user avatar
0 votes
1 answer
108 views

I have a problem with array_unique() in PHP. Here is my code: $filterGroupsArray = ['', 'a', 'a', 'b']; print_r($filterGroupsArray); array_unique($filterGroupsArray); print_r($filterGroupsArray); The ...
broxyl's user avatar
  • 37
-1 votes
1 answer
382 views

I am getting duplicate data in an array and that data is storing in my DB. I am using array_unique to refine the duplicate data but it is not working. Please tell me is there any other way to make ...
Umair Basit's user avatar
0 votes
1 answer
56 views

my code is : $a = <<<'EOD' function makeItBIG($a_lot_of_names) { foreach($a_lot_of_names as $the_simpsons) { $BIG[] = strtoupper($the_simpsons); } return $BIG; } $a_lot_of_names = [...
RsF's user avatar
  • 21
0 votes
1 answer
134 views

I have an object which contains 3 arrays, any of which may be empty, it is feasible all three can be empty, so I need to handle that requirement too. Here's an example of the object: { "...
Kaleb Thompson's user avatar
1 vote
3 answers
103 views

Is it possible to remove sub arrays, if the array item at position 0 of that sub array matches subsequent items? For example; Array ( [0] => Array ( [0] => 1234 [1] => XX000 ) [1] =&...
user1235285's user avatar
0 votes
0 answers
176 views

stdClass Object ( [id] => 132 [slug] => test [parent_id] => 15 ) stdClass Object ( [id] => 132 [slug] => test [parent_id] ...
ebrahim's user avatar
  • 87
1 vote
3 answers
212 views

I am trying to create a method called filer_out! that takes in an array and a proc, and returns the same array but with every element that returns true when it is run through the proc, with the caveat ...
Chad Cunningham's user avatar
0 votes
3 answers
79 views

I have 2 arrays and need to find the unique values in the second array that are not in the first array and output those to a third array. Array 1 $array1 = array( 0 => 'value12', 1 => '...
Mike's user avatar
  • 607
1 vote
2 answers
78 views

I want to find duplicates in a multidimensional array and then echo out which one who has duplicates and which not. I've tried this code. $teams = array ( "grupp_A" => array('Arsenal','...
Anders's user avatar
  • 113
6 votes
2 answers
568 views

I've stumbled upon something weird and I don't understand why it works that way. I have an array of numbers, they are all unique: $array = [ 98602142989816970, 98602142989816971, ...
Arthur Shveida's user avatar
0 votes
1 answer
34 views

I have following array result: Example: [ { id: "1", league: { name: "World Club Friendlies", team: "Simple 1 & Simple 2" } }, ...
Carolina Ramirez's user avatar
0 votes
1 answer
71 views

Let me explain my situation, i got myself a multidimensional array.. Down below is the print_r of my array. Array ( [0] => Array ( [firstname] => Tinga [...
Izzy's user avatar
  • 61
-1 votes
2 answers
210 views

I want to get only the distinct values from $pjt. I have tried the below code: $unique_pjtdata = array_unique($pjt); foreach($unique_pjtdata as $val) { echo $val; } I am getting an HTTP Error ...
FRECEENA FRANCIS's user avatar
0 votes
1 answer
52 views

I have: ['countryCode' => 11, 'postalCode' => 12345], ['countryCode' => 11, 'postalCode' => 12346], ['countryCode' => 11, 'postalCode' => 12347], ['countryCode' =>...
dogray77's user avatar
1 vote
1 answer
125 views

I have removed the duplicate items for the following array, by writing: $outcome['id'] = array_unique($outcome['id'], SORT_REGULAR); but I'm getting undesirable JSON output "id": { "0"...
Anisha Pal Mohor's user avatar
-1 votes
1 answer
351 views

I have an array that repeats the same values twice. I am unable to count the total of the unique values. I mean the phone number is unique and when the same phone number appears twice it should be ...
shandonjoe's user avatar
2 votes
3 answers
311 views

I have a PHP code which runs on PHP7 but not in PHP 5, which PHP version in my server, that is my code: Array ( [0] => stdClass Object ( [userId] => 15 [name] => name0 ...
Ali A. Jalil's user avatar
0 votes
1 answer
106 views

I'm writing some code to automate fontfaceobserver.js. For each font file in a directory I need to get the font family name so I can print it in the javascript. Some of the fonts share the same family ...
Chris J. Zähller's user avatar
-1 votes
4 answers
1k views

Need to merge the Multidimensional array into single array, thereby, eleminating the duplicate values taking key as username and values as their user friends details Array ( [Nishanth] => ...
Nɪsʜᴀɴᴛʜ ॐ's user avatar
0 votes
2 answers
1k views

Why foreach loop printing only the first value from the array? $Jdata_cate = '[{"category_id":"103","name":"Martin","parent_id":0},{"category_id":"10","name":"Juan","parent_id":0},{"category_id":"9","...
Meto ballaes's user avatar
0 votes
2 answers
250 views

I have a multidimensional array, consisting of products. Each sub-array has a product type. The productType is is in an array inside the Product array, such that; 0 => product [ productType [ ...
Twisterr1000's user avatar
0 votes
2 answers
618 views

I'm using print_r(array_unique($array, SORT_REGULAR)); on the array below but it does not work. I'm trying to filter out the redundant data. Notice that [Order] and its key value pairs are all the ...
Mike's user avatar
  • 607
0 votes
0 answers
41 views

I have an array below in which I want to get or remove duplicate values: $data = $responses; var_dump($data); result is: array(11) { [0]=> string(4) "date" [1]=> string(4) "name" ...
Eem Jee's user avatar
  • 1,319
1 vote
0 answers
186 views

Here is the description of array_unique() in PHP 7.2: If sort_flags is SORT_STRING, formerly array has been copied and non-unique elements have been removed (without packing the array afterwards)...
TungPS's user avatar
  • 51
0 votes
2 answers
67 views

I can't manage to sort an array alfabetically. It's an array with cities that I get from an external XML. The XML looks like this, and it's the node localidad I am trying to sort. <parada> ...
Helenp's user avatar
  • 143
0 votes
1 answer
312 views

contains the following i am trying get array_unique value from multidimensional associative array Here, i am only showing only sample array which is similar to this. $array = ['games'=>[['...
VijayaKrishna's user avatar
0 votes
1 answer
2k views

I was following this but it still doesn't work for me: How to remove duplicate data of JSON object using PHP In my PHP file I have 3 JSON arrays: {"results":[{"cat_id":2,"cat_name":"veterinarian"...
CHarris's user avatar
  • 2,803
0 votes
1 answer
1k views

I have a multi-dimensional array that contains an associative array in every row. How to make it unique based on specified array key? I already tried some method like: $cart = array_map("...
Alimin's user avatar
  • 2,797
-4 votes
1 answer
348 views

I am outputting results from a table with multiple columns. So I used a foreach loop to loop through but it is returning double results. Here is my code: <?php while($row=$stmt_header->fetch(...
Manzu Gerald's user avatar
0 votes
1 answer
83 views

There's been discussions about this topic before, but I haven't been able to get any of the examples from them to work in my case. Hoping this is an easy fix that may help others having similar ...
Justiciar's user avatar
  • 376
-1 votes
1 answer
65 views

I'm building out a filtering function that loops through provided data to generate select field options based on a declared array key. I can get my function to output the expected unique results when ...
Matt's user avatar
  • 828
0 votes
2 answers
1k views

I would like to combine these two foreach statements together. I've seen a few solutions around here, but nothing really works for me. This is my username list from database. $digits = [1,2,3,4]; $...
Prox's user avatar
  • 11
0 votes
1 answer
96 views

My code is working but there is a small possibility to have duplicated $categoryurl as output, how can I keep the uniques only? I have a folder called "xml" in the webroot, I use glob() to search the ...
jagb's user avatar
  • 922
1 vote
2 answers
3k views

I have a PHP array that looks like this... Array ( [0] => Array ( [id] => 1 [value] => 111 [date] => 'today' ) [1] => Array ( [id] =>...
fightstarr20's user avatar
  • 12.9k
1 vote
3 answers
132 views

I want to remove duplicates image. How to use array_unique? This is what I have tried: $text = 'text image.jpg flower.jpg txt image.jpg'; $pattern = '/[\w\-]+\.(jpg|png|gif|jpeg)/'; $result = ...
harry's user avatar
  • 33
0 votes
0 answers
391 views

I'm trying to get to one array that don't have duplicate values for a specific field in an array of objects. I've merged two array's of objects together and am using $unique = array_unique($merged, ...
Ale's user avatar
  • 447
0 votes
2 answers
576 views

I'm trying to populate multiple rows from data.txt by preg_match_all() to single row or column in data.csv. It needs to be in single array because I need only unique numbers (or any other option the ...
Simon's user avatar
  • 17
1 vote
1 answer
36 views

I have a multidimensional array like this Array ( [0] => Array ( [name] => test [c1] => flower [c2] => fruit [date] => 2017-...
Wali Hassan's user avatar
1 vote
3 answers
230 views

How can I delete duplicates from multiple arrays? pinky and cocos are double in my array. All words which are double, must be removed. If those are removed, I will put these words in my select. I ...
user avatar