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 to write the form tag correctly for uploading files?
What is polymorphism with example in php?
How can you create a session in php?
What are the functions for imap?
What is php destruct?
What are the methods of array in java?
Tell me how to retrieve a cookie value?
How to add comments in php?
Explain what is smarty?
Explain why would we use === instead of ==?
What does mysqli_query return?
Why shouldn't I use mysql_* functions in php?
Explain me the difference between include and require?
What is php variable?
How to assigning a new character in a string using php?