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
Do you know how to declare an array in php?
Which is better php or nodejs?
What are the functions for imap?
What is a lambda function in php?
What are php strings?
can we swap two different string using php for example:-- before swapping:-- 1 string :-hello friend, 2 string :-my dear, after swapping that strings will be: 1.hello dear, 2.my friend.
What is T_PAAMAYIM_NEKUDOTAYIM?
When sessions ends?
How To Get the Uploaded File Information in the Receiving Script?
What are the advantages of triggers?
How do I install php and apache on windows 10?
What is echo in html?
What is the difference between runtime exception and compile time exception?
Does php have block scope?
How do I run a php program in dreamweaver?