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 composer json?
Which php mvc framework is best?
What are the different ways to login to a remote server?
What is csrf token and how it works?
Can you pass an array into a function?
Is php used for frontend or backend?
What is in php 7?
Which is used to maintain the value of a variable over different pages?
Explain how can php and javascript interact?
Is laravel an oop?
What is config file in php?
What does namespace mean in php?
Explain the ternary conditional operator in php?
What is the use of final class in php?
In PHP, fgets() is used to read a file one line at a time. State Whether True or False?