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 difference Between PHP 5 and 7?
Does cors prevent csrf?
Is empty check in php?
How can you retrieve a cookie value?
What is putenv?
What should we do to be able to export data into an excel file?
Tell me what are the functions to be used to get the image's properties (size, width and height)?
What is difference between required and include in php?
What is the use of pear in php?
How to get useful error messages in php?
What is PHP's configuration file called?
How to make a class in php?
How to remove duplicate values from php array?
Explain the value of the variable input is a string 1,2,3,4,5,6,7. How would you get the sum of the integers contained inside input?
What is final in php?