Questions tagged [array-intersect]

PHP's array_intersect() function accepts the array with master values to check, an array to compare values against and a variable list of arrays to compare. It returns an array containing all of the values in master array whose values exist in all of the parameters.

PHP's array_intersect() function accepts the array with master values to check, an array to compare values against and a variable list of arrays to compare. It returns an array containing all of the values in master array whose values exist in all of the parameters.

169 questions
0
votes
2 answers

php array_intersect not functioning correctly

I currently have 2 arrays where i would like to compare dates in. here are how my arrays are structured: $bholidays = array('05-05-2014','26-05-2014'); $userdaysoff = array('23-05-2014','24-05-2014','25-05-2014', '26-05-2014'); The aim is to…
danyo
  • 5,686
  • 20
  • 59
  • 119
0
votes
1 answer

php array_intersect making issues and i'm not able to check the empty array

I have five arrays and a search for which user can do search randomly. So for among those five sometimes there may be value for two arrays, three arrays or five arrays and whatever. So When I intersect I am not be able to check which are empty so…
Codegiant
  • 2,110
  • 1
  • 22
  • 31
0
votes
2 answers

PHP: retrieve multiples arrays using AND not OR

I use facebook graph api to retrieve my facebook posts and display them on my website. So far I have filtered my post by tags using this code (this code retrieves the FB posts tagged with -fr- / others post are tagged with -en- : which allow me to…
MagTun
  • 5,619
  • 5
  • 63
  • 104
0
votes
1 answer

Regarding array_intersect

I have 2 arrays. One with usernames from Moodle($allUsers), and the other one with usernames from an external source($dataClip). I need to compare them and add them in bulk, if not already enrolled. function buildURL($year, $period,…
user3178356
  • 73
  • 1
  • 7
0
votes
2 answers

How to match data values with array values

So i'm trying to match the values from the database with values from an array. This is the data from database $verdeel = explode(", ", $data['product']); $getallen = array("10", "20"); if(array_intersect($verdeel, $getallen)){ for($i=0;$i <…
user3244093
0
votes
3 answers

I am not able to intersect arrays. POST, PHP, How to intersect the POST array?

1) I am not able to intersect arrays: 2) I am not able to get values of associative POST array using a key $adbcols=Array ( [tcid] => tcid .... array containing database column names $aformval=Array ( ['tcbcheck'] => on ['tcprice'] => 100…
Gintare Statkute
  • 677
  • 2
  • 8
  • 18
0
votes
2 answers

array_intersect for sub arrays

I've an associative array like this. $lang['lbl_mylabel1'] = array('key1' => 'value1'); $lang['lbl_mylabel2'] = array('key2' => 'value1'); $lang['lbl_mylabel3'] = array('key3' => 'value1'); $lang['lbl_mylabel4'] = array('key4' =>…
Mj1992
  • 3,404
  • 13
  • 63
  • 102
0
votes
2 answers

Same values from different arrays in one variable

I have a question, because I can't figure it out and I can't find it anywhere (maybe the wrong search-words I don't know..). I have the following: Array ( [0] => Array ( [Factuurnummer] => 50 [Omschrijving] =>…
user3050534
  • 227
  • 4
  • 17
0
votes
2 answers

List of Arrays intersect

I have some arrays called $array[1], $array[2] etc. $array[1] is something like array(1,2,3) and $array[2] is sth. like array(2,3,4) now I want to have alle numbers which are in all arrays. I want to use array_intersect($array[1],$array[2]) for…
Wikunia
  • 1,564
  • 1
  • 16
  • 37
0
votes
2 answers

Method for comparing array keys and creating MySQL Statements

In a user system we are building, a client is able to sell a number of products that we offer. The number of these products is not too extensive but we may (and plan to add new products often). When a user logs into their administration portal, they…
JM4
  • 6,740
  • 18
  • 77
  • 125
0
votes
2 answers

PHP Recursive Array Intersect Key Tripping over string value

I'm currently receiving an error PHP Catchable fatal error: Argument 2 passed to NUI::recArrInterKey() must be an array, string given when trying to recursively intersect a multidimensional array (grey/white list). It seems to be tripping on the…
ehime
  • 8,025
  • 14
  • 51
  • 110
0
votes
3 answers

Getting human readable names for forms

I have been working on this for the past 4 hours, with problem after problem. Now that I have finally come to the end of most of my problems, I can't seem to get a solution to the final problem. Problem: I have to send out an email to a student…
Rixhers Ajazi
  • 1,303
  • 11
  • 18
0
votes
3 answers

Issue comparing two exploded php arrays to find overlap

I'm comparing the results of two exploded strings (results from a query), though when I use array_intersect to find the overlap of the arrays, I unfortunately only receive the overlap of those tags which are come first in each array...so for example…
mhawk
  • 29
  • 6
0
votes
1 answer

PHP intersect two arays and replace one item

I have two multidimensional arrays which I want to intersect using PHP array_intersect function, but prior to do the output for this it must also make a replacement for only one element of array. Example: $array1 = Array( Array(37768201, 273,…
0
votes
1 answer

Select common arrays from two mutidimension arrays - PHP

My first array is Array ( [0] => Array ( [user_id] => 1 [name] => name1 ) [1] => Array ( [user_id] => 2 [name] => name2 ) ) My Secondarray is Array ( [0] => Array ( [user_id]…
FrancisMV123
  • 3,419
  • 4
  • 20
  • 20