duckstar Posted March 19, 2010 Share Posted March 19, 2010 Hi There, I was wondering if anyone is able to tell me how i can do this ? Two needles and 1 haystack I have tried http://www.phpfreaks.com/forums/index.php/topic,100952.msg399073.html#msg399073 to no avail the $matches value just returns "Array" Its pretty simple, i just need to search a multi dimensional array to find the index. But these need to be true haystack[i][1] = needle1 haystack[i][2] = needle2 There will only be one record that both [1] = needle1 and [2] = needle 2 But obviously multiple records with just one being true. Any help would be much appreciated ! Link to comment https://forums.phpfreaks.com/topic/195804-two-needles-1-haystack/ Share on other sites More sharing options...
Mchl Posted March 19, 2010 Share Posted March 19, 2010 Perhaps do a var_dump($matches) to see what's in the array you're getting? Link to comment https://forums.phpfreaks.com/topic/195804-two-needles-1-haystack/#findComment-1028601 Share on other sites More sharing options...
duckstar Posted March 19, 2010 Author Share Posted March 19, 2010 Hmmm it contains the following... array(3) { [0]=> array(18) { [0]=> bool(false) [1]=> bool(false) [2]=> bool(false) [3]=> bool(false) [4]=> bool(false) [5]=> bool(false) [6]=> bool(false) [7]=> bool(false) [8]=> bool(false) [9]=> bool(false) [10]=> bool(false) [11]=> bool(false) [12]=> bool(false) [13]=> bool(false) [14]=> bool(false) [15]=> bool(false) [16]=> bool(false) [17]=> bool(false) } [1]=> array(18) { [0]=> bool(false) [1]=> bool(false) [2]=> bool(false) [3]=> bool(false) [4]=> bool(false) [5]=> bool(false) [6]=> bool(false) [7]=> bool(false) [8]=> bool(false) [9]=> bool(false) [10]=> bool(false) [11]=> bool(false) [12]=> bool(false) [13]=> bool(false) [14]=> bool(false) [15]=> bool(false) [16]=> bool(false) [17]=> bool(false) } [2]=> array(18) { [0]=> bool(false) [1]=> bool(false) [2]=> bool(false) [3]=> bool(false) [4]=> bool(false) [5]=> bool(false) [6]=> bool(false) [7]=> bool(false) [8]=> bool(false) [9]=> bool(false) [10]=> bool(false) [11]=> bool(false) [12]=> bool(false) [13]=> bool(false) [14]=> bool(false) [15]=> bool(false) [16]=> bool(false) [17]=> bool(false) } } Not entirely sure what's going on there... Link to comment https://forums.phpfreaks.com/topic/195804-two-needles-1-haystack/#findComment-1028604 Share on other sites More sharing options...
duckstar Posted March 19, 2010 Author Share Posted March 19, 2010 The GLOBALS are going through fine, and the needles1 and needles 2 i am using are definitely in the Array i am searching... the array_diff doesn't seem to be stripping out the matched ones... Link to comment https://forums.phpfreaks.com/topic/195804-two-needles-1-haystack/#findComment-1028608 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.