0

How to get the Cat by using the value Nap in array

["Dog" => "Bite", "Cat" => "Nap"] 

and i want to get Cat using value Nap

Mohammad
  • 21,175
  • 15
  • 55
  • 84

2 Answers2

0
$key = array_search('Nap', $array);
Dave
  • 3,073
  • 7
  • 20
  • 33
Sanu0786
  • 571
  • 10
  • 15
0

What is not clear in your question is if you already know the entry is the last entry, or if you're searching for a value that is somewhere in your array.

Cyrus G
  • 21
  • 5