How to find a specific value in an array?



How to find a specific value in an array?..

Answer / Hareesh Gaurav

To find a specific value in an array, you can use the in_array() function or array_search(). Here's an example using array_search(): `$array = array("apple", "banana", "cherry"); $value = "banana"; if (array_key_exists($value, $array)) { echo $value . " found!"; } else { echo $value . " not found!" ;}"

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

What is mvc php?

1 Answers  


What is isset php?

1 Answers  


Difference between $message vs. $$Message in php.

1 Answers  


Is php session id unique?

1 Answers  


write a prog using insert,update,delete in this manner as output? name: phno. add button 1.name phno. edit button delete button 2.

1 Answers  


Who is known as the father of php?

1 Answers  


What is the super method?

1 Answers  


What is is_null() in php?

1 Answers  


what is hidden variable? what is its difference with the normal variable...

2 Answers   Shine,


How do sessions work in php?

1 Answers  


Explain what does the expression exception::__tostring means?

1 Answers  


Tell me what is the use of "ksort" in php?

1 Answers  


Categories