1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP array query? I'm probably just tired!

Discussion in 'PHP' started by Weirfire, Feb 2, 2006.

  1. #1
    The function isn't coming to mind but I've been working for a while now so I'm probably just getting a blank but;


    how would I check if variable $x exists within array $y[]

    I know I could set up a loop to go through element of $y[] but is there a quick way to check it?
     
    Weirfire, Feb 2, 2006 IP
  2. rossriley

    rossriley Guest

    Messages:
    25
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try...
    $key = array_search('value', $array);
     
    rossriley, Feb 2, 2006 IP
    Weirfire likes this.
  3. smo

    smo Well-Known Member

    Messages:
    41
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    123
    #3
    smo, Feb 3, 2006 IP
    Weirfire likes this.
  4. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #4
    Thanks guys, those are both useful :)
     
    Weirfire, Feb 4, 2006 IP