How can I check if a value is already in an array?
Answer Posted / deep
The above answer is correct. I will just add a complete
example.
<?php
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os))
{
echo "Got Irix";
}
if (in_array("mac", $os))
{
echo "Got mac";
}
?>
Is This Answer Correct ? | 7 Yes | 2 No |
Post New Answer View All Answers
How is the ternary conditional operator used in php?
What websites use php?
How to read a file in binary mode?
What is static in php?
How to download file in php?
Tell me what does the php error 'parse error in php - unexpected t_variable at line x' means?
How to randomly retrieve a value from an array?
What is difference between include,require,include_once and require_once()?
What is the most common http method?
What is composer used for?
How do you measure variables?
What is the purpose of constant() function?
Tell me how can we connect to a mysql database from a php script?
Is python better than php?
What is encapsulation in php with example?