By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,730 Members | 1,399 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,730 IT Pros & Developers. It's quick & easy.

Array_Search Problems

P: 1
Hi all... I am having problems with the array_search function. No matter what I do, I can't get it to find a value that I specify. Here is the code I am using to call it:

[PHP]$value = 'month';
$key= array_search($value, $array);[/PHP]

Yet, it won't work, I have done it using the value itself, itstead of a variable, and I have searched for several different things that I know are in the array.

I also have a question aboud the array_search function, do you have to search for the exact value? Or can you search for say "month" when you know that there is a value in the array "month and date"? Thanks for your help...
Feb 5 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 3,235
Welcome to The Scripts.
Check out the documentation for the array_search() function. Try out their example.
You will need to have an exact match in the array.
Feb 5 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.