Home >> PHP >> in_array() function in PHP

in_array() function in PHP

The in_array() function used for searches any value an array.

Syntax

in_array(search,array,strict)

strict are true or false

Example

$array = array("ram", "shyam", "ravi");

if (in_array("shyam", $array)){
    echo "Match found in array";
}

Output

Match found in array

Post Your Comment

Next Questions
key() function
krsort() function
ksort() function
list() function
natcasesort() function
natsort() function
pos() function
prev() function
range() function
reset() function
rsort() function
shuffle() function
sizeof() function
sort() function
uasort() function
uksort() function
usort() function
What is the difference between array_combine() and array_merge()
What are the differences between array_diff(), array_diff_assoc() and array_diff_key()
What is the difference between array_intersect_assoc() and array_intersect_key()
What is difference between array_push() and array_pop()
What is difference between array_product() and array_sum()
What is the difference between session and cookie
What is session & work
What are data types

Copyright ©2022 coderraj.com. All Rights Reserved.