Jump to content

in array problem?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Hamed

Hamed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 276 posts
This is my array:
  $arr =  array(
    'ali' => "very goood",
    'hamed' = > "very good"
    );
I want to check element name.
in_array(ali,$arr)
but I can not!!!
How to do it!

Edited by Hamed, 04 December 2010 - 01:08 AM.


#2
DEViANT

DEViANT

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 358 posts
This is what it should look like :

 $arr =  array(
    'ali' => "very goood",
    'hamed' = > "very good"
    ) ; 

You need to use a comma to separate your items, not a semicolon.

:D You should rep+ me so that I can win :D

My Blog | Ask me!
Error : Satan did it

#3
Hamed

Hamed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 276 posts
I know this problem.
but I want to know how to search in element name!?

#4
DEViANT

DEViANT

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 358 posts
PHP: array_key_exists - Manual

:D You should rep+ me so that I can win :D

My Blog | Ask me!
Error : Satan did it

#5
Hamed

Hamed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 276 posts
Thanks,
This is what I want!