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
What are hooks in php?
How send email in php?
Is it possible to extend the execution time of a php script?
Where is the functions php in wordpress?
Which cryptographic extension provide generation and verification of digital signatures?
What sized websites have you worked on in the past?
What is meant by public, private, protected, static and final scopes?
Require_once(), require(), include(). What is difference between them?
What is inheritance in php? How many types of inheritance supports php?
How can I increase my website session?
Do loops php?
How to access standard error stream in PHP?
Tell me what is the difference between get and post?
What is null value in php?
How to create a public static method in PHP?