Guardian-Mage Posted September 15, 2007 Share Posted September 15, 2007 ok, so $username = "Root". I need to check if the value of $username, in this case is in an array. $user[0] = "Root"; $pass[0] = "Root"; $admin[0] = $user[0]; $user[1] = "Cindy"; $pass[1] = "cindyloo"; $user[2] = "James"; $pass[2] = "simpsons"; $user[3] = "Geoff"; $pass[3] = "Icecream"; $user[4] = "Dawn"; $pass[4] = "furious"; $username = "Root"; In the case above, I need it to check to see if the username is in the user array, and in this case it is, with the value $user[0]. How can I check this? Do I use foreach or something? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 15, 2007 Share Posted September 15, 2007 $keynum = array_keys($user, 'Root'); if it is found you shoule return 0 (the index of that occurence in the array). Quote Link to comment 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.