Array_Search Problems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Johnnyboy01
    New Member
    • Feb 2007
    • 1

    #1

    Array_Search Problems

    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($v alue, $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...
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    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.

    Comment

    Working...