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 long do php sessions last?
How do you identify independent and dependent variables in regression analysis?
When are you supposed to use endif to end the conditional statement?
Is json a string php?
What is the method to execute a php script from the command line?
What should we do to be able to export data into an excel file?
How long will it take to learn php?
Do you know what is the difference between the include() and require() functions?
How do I find out the number of parameters passed into function9?
Is it possible to extend the execution time of a php script?
Tell me how to set a page as a home page in a php based site?
What is difference between session_unset and session_destroy?
Which methods should be used for sending an email using the variables $to, $subject, and $body?
What is string and its function?
Why do you need php?