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
explain php variable length argument function.
What is php variable?
What does the scope of variables means?
What are the steps for the payment gateway processing?
How do you trim spaces in excel?
How to convert strings in hex format?
Why do we use session?
What is difference between echo and print_r in php?
How to merge values of two arrays into a single array?
What is the use of mysql_real_escape_string() function?
What are the ways to include file in php?
Explain the three different kinds of Arrays?
How do you end a function in python?
Explain Traits in PHP?
How can I load data from a text file into a table?