KingOfHeart Posted November 5, 2010 Share Posted November 5, 2010 print_r($lmem); print_r($online); print_r($birth); OutPut... Array ( [id] => 13610 [name] => enormantuckere [href] => http://www.thegaminguniverse.com/forum/index.php?action=profile;u=13610 [link] => enormantuckere ) Array ( [users] => Array ( [2010-11-04 22:59:11Guardian] => Array ( [id] => 264 [username] => Guardian [name] => Guardian [group] => 11 [href] => http://www.thegaminguniverse.com/forum/index.php?action=profile;u=264 [link] => Guardian [hidden] => [is_last] => 1 ) ) [guests] => 5 [hidden] => 1 [buddies] => 0 [num_users] => 2 [total_users] => 7 ) Array ( [0] => Array ( [id] => 148 [name] => Knuckles [age] => 24 [is_last] => [is_today] => 1 ) [1] => Array ( [id] => 12290 [name] => xgmx [age] => 18 [is_last] => 1 [is_today] => 1 ) ) How do I check to see if there's a user in the $online list that matches $lmem ? How do I check to see if there's a user in the $online list that matches $birth ? I only want to check username arrays but I'm not sure how to do that even. I got some more questions but I'll wait until I can get some answers. I have no control over this array (no authority), I just output it. Quote Link to comment https://forums.phpfreaks.com/topic/217812-some-array-help/ Share on other sites More sharing options...
OldWest Posted November 5, 2010 Share Posted November 5, 2010 First off, can you please print the output of your queries using the <pre> format like this: echo '<pre>'; print_r($lmem); echo '</pre>'; Then I can probably give you some guidance to resolve your issue. Quote Link to comment https://forums.phpfreaks.com/topic/217812-some-array-help/#findComment-1130554 Share on other sites More sharing options...
KingOfHeart Posted November 6, 2010 Author Share Posted November 6, 2010 Array ( [id] => 13610 [name] => enormantuckere [href] => http://www.thegaminguniverse.com/forum/index.php?action=profile;u=13610 [link] => enormantuckere ) Array ( [users] => Array ( [2010-11-06 16:20:52Janus] => Array ( [id] => 420 [username] => Janus [name] => Janus [group] => 1 [href] => http://www.thegaminguniverse.com/forum/index.php?action=profile;u=420 [link] => Janus [hidden] => [is_last] => ) [2010-11-06 16:20:02Guardian] => Array ( [id] => 264 [username] => Guardian [name] => Guardian [group] => 11 [href] => http://www.thegaminguniverse.com/forum/index.php?action=profile;u=264 [link] => Guardian [hidden] => [is_last] => ) [2010-11-06 16:14:00Rowan] => Array ( [id] => 93 [username] => Rowan [name] => Rowan [group] => 1 [href] => http://www.thegaminguniverse.com/forum/index.php?action=profile;u=93 [link] => Rowan [hidden] => [is_last] => 1 ) ) [guests] => 18 [hidden] => 1 [buddies] => 0 [num_users] => 4 [total_users] => 22 ) Array ( [0] => Array ( [id] => 534 [name] => Aleksey [age] => 21 [is_last] => [is_today] => 1 ) [1] => Array ( [id] => 2015 [name] => The_Dark_Man [age] => 20 [is_last] => [is_today] => 1 ) [2] => Array ( [id] => 2003 [name] => Layer 01 [age] => 25 [is_last] => [is_today] => 1 ) [3] => Array ( [id] => 2981 [name] => Dustbin [age] => 20 [is_last] => [is_today] => 1 ) [4] => Array ( [id] => 5942 [name] => Ryu Hayabusa [age] => 21 [is_last] => 1 [is_today] => 1 ) ) Helps a bit. So that means one of the $online array would look like this? $online['users'][2010-11-06 16:20:52Janus][username] Since I only need the username array that might make things a little tricky. Quote Link to comment https://forums.phpfreaks.com/topic/217812-some-array-help/#findComment-1131156 Share on other sites More sharing options...
Stephen68 Posted November 6, 2010 Share Posted November 6, 2010 can't you just use in_array? http://php.net/manual/en/function.in-array.php. not sure if that helps. On my way out the door will check back later... Quote Link to comment https://forums.phpfreaks.com/topic/217812-some-array-help/#findComment-1131183 Share on other sites More sharing options...
KingOfHeart Posted November 11, 2010 Author Share Posted November 11, 2010 Well I managed to get all the information for birth into an array, and users into another array. How do I search two arrays and see if there are any matches between them? Quote Link to comment https://forums.phpfreaks.com/topic/217812-some-array-help/#findComment-1132876 Share on other sites More sharing options...
OldWest Posted November 11, 2010 Share Posted November 11, 2010 Well I managed to get all the information for birth into an array, and users into another array. How do I search two arrays and see if there are any matches between them? It would probably a lot easier just to run a comparison query directly on your tables. Quote Link to comment https://forums.phpfreaks.com/topic/217812-some-array-help/#findComment-1132893 Share on other sites More sharing options...
KingOfHeart Posted November 12, 2010 Author Share Posted November 12, 2010 Probably, but not allowed to access those tables. So there's no function to check two different arrays for matches? Quote Link to comment https://forums.phpfreaks.com/topic/217812-some-array-help/#findComment-1133316 Share on other sites More sharing options...
.josh Posted November 12, 2010 Share Posted November 12, 2010 yes, there is array_intersect, however, you will need to reformat your arrays to work with it. Quote Link to comment https://forums.phpfreaks.com/topic/217812-some-array-help/#findComment-1133329 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.