array-unique Questions

7

Solved

I have an array Array( [0] => Array ( [0] => 33 [user_id] => 33 [1] => 3 [frame_id] => 3 ) [1] => Array ( [0] => 33 [user_id] => 33 [1] => 3 [frame_id]...
Osteotomy asked 1/4, 2010 at 14:50

3

Solved

I am in doubt what to use: foreach(){ // ..... if(!in_array($view, $this->_views[$condition])) array_push($this->_views[$condition], $view); // .... } OR foreach(){ // ..... arra...
Wondering asked 10/4, 2013 at 21:53

3

Solved

I have an array of Musical Tracks and in this array the same song can show up multiple times due to being released on multiple albums. I am trying to remove them from the array so that only true un...
Vang asked 6/10, 2011 at 18:0

2

Solved

Below is the variable I have, $string = 'AAA,BBB,aAA,BbB,AAA,BbB'; I need the unique string result below, $string = 'AAA,BBB,aAA,BbB'; How to make it unique just like array_unique() fu...
Sweptwing asked 6/4, 2017 at 10:11

8

Solved

I use the line of code below to loop through a table in my database: $items_thread = $connection -> fetch_all($sql); And if I print the array out: print_r($items_thread); I will get ...
Heterosis asked 18/2, 2011 at 0:25

4

Solved

Not sure if this is possible but im trying to run array_unique over a collection of items i have, to remove duplicates. Although i cannot get it working. my controller logic: // init models $jo...
Create asked 5/9, 2013 at 2:0

4

Solved

If I had an array of signed integers e.g: Array ( [0] => -3 [1] => 1 [2] => 2 [3] => 3 [4] => 3 ) To get unique values I would instinctively use array_unique but after consid...
Hearse asked 30/11, 2011 at 5:40

4

Solved

I have the following variable $rows: Array ( [0] => stdClass Object ( [product_sku] => PCH20 ) [1] => stdClass Object ( [product_sku] => PCH20 ) [2] => stdClass Object (...
Scorpius asked 5/7, 2012 at 8:23

3

Solved

I need a function like array_unique for arrays inside array. The Case - should be equal, but output "not equal": <?php $arr=array(array('a',1),array('a',2)); $arr2=array_unique($arr); if($arr2...

3

Solved

I am checking the array_unique function. The manual says that it will also sort the values. But I cannot see that it is sorting the values. Please see my sample code. $input = array("a" => "gre...
Tridactyl asked 16/8, 2014 at 7:21

5

Solved

Is there an array function in PHP that somehow does array_merge, comparing the values, ignoring the keys? I think that array_unique(array_merge($a, $b)) works, however I believe there must be a nic...
Nappie asked 11/1, 2011 at 17:40

2

Solved

I am trying to learn how to use array_unique, so I made some sample code and I didn't get what I expected. $array[0] = 1; $array[1] = 5; $array[2] = 2; $array[3] = 6; $array[4] = 3; $array[5] = 3;...
Archaeopteryx asked 13/2, 2014 at 19:1

4

Solved

I have an array like this Array ( [0] => Array ( [id] => BA [name] => British Airways ) [1] => Array ( [id] => BA [name] => British Airways ) [2] => Array ( [i...
Judgemade asked 3/5, 2013 at 11:22

3

Solved

I have the following code that is not returning as I expected. I was hoping the final result would be a string: $organizers = array_unique($organizers); // this returns correctly $organizers = imp...
Scutch asked 12/12, 2012 at 18:6

1

Solved

Possible Duplicate: Re-index numeric array keys I have an array as follows Array ( [0] => 15/11/2012 - 18/11/2012 [1] => 15/11/2012 - 18/11/2012 [2] => 15/11/2012 - 18/11...
Maffick asked 28/11, 2012 at 1:8

1

Solved

I am having a bit of an issue with my PHP array. First thing they have arrays inside of this array and I am trying to remove duplicates. I did a print_r of my array and it printed out this.... Arr...
Chukchi asked 11/2, 2012 at 21:5

2

Solved

This refers to one of my previous questions: array_unique vs array_flip - This states that array_flip(array_flip()) is much quicker than array_unique() when dealing with simple strings and integers...
Orthodontics asked 1/12, 2011 at 21:39

5

Solved

I found a few solutions but I can't decide which one to use. What is the most compact and effective solution to use php's array_unique() function on a case-insensitive array? Example: $inpu...
Colossian asked 5/6, 2011 at 1:53
1

© 2022 - 2024 — McMap. All rights reserved.