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
Tell me how can you pass a variable by reference?
What are php expressions?
What is php artisan serve?
Php error constants and their descriptions
How to remove duplicate values from array using php?
When use javascript vs php?
What is array function in javascript?
Can age be a variable?
What is meant by variable variables in php?
How can we enable error reporting in php?
What are objects in php?
What is associative array in php?
What are the encryption functions available in PHP?
Tell me how a constant is defined in a php script?
What is __ construct in php?