Jump to content

Get an array's index number


therealwesfoster

Recommended Posts

Here's what I need.

 

Lets say I have an array:

$arr = array("a","b","c","d");

 

I want to be able to do something like:

echo array_index_number("c",$arr);

 

It should echo 2 (because $arr[2] is c)

Now I know that isn't a real function (or is it? that'd be weird), but thats what I'm trying to do. How would I do this?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/101464-get-an-arrays-index-number/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.