How can I check if a value is already in an array?
Answer Posted / mohammed khalid khan
The first answer is not complete.
&
The second answer is correct.
<?php
$values = array("banana","apple","pear","banana");
if (in_array("pear",$values))
{
echo "Got pear";
}
?>
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is laracast?
What are the encryption functions available in PHP?
What is the difference between explode and split?
Explain what are psrs?
What is php sequence?
How to assigning a new character in a string using php?
How to remove an empty directory?
How to make database connection in php?
What is the difference server side and browser side validation?
Explain briefly about a search-friendly site looks like?
What is htaccess in php?
Explain me what is the difference between explode() and split() functions?
Are php variables global?
What is data type in php?
Why is used in php?