Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can I check if a value is already in an array?

Answer Posted / mohammed khalid khan

The first answer is not complete.
&
The second answer is correct.


<?php
$values = array("banana","apple","pear","banana");
if (in_array("pear",$values))
{
echo "Got pear";
}
?>

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is basename php?

922


Are react hooks stable?

892


Can you explain, when to use if-else if-else over switch statements?

964


What is prepare in php?

969


How do I use isdigit function?

1003


Tell me how is it possible to return a value from a function?

957


Which functions are used to count the total number of array elements in php?

996


What are the difference between abstract class and interface in oops?

952


Which function is used in php to delete a file?

983


What is $_ server request_method == post?

1034


How many php functions are there?

1012


What enctype is required for file uploads to work?

969


What is difference between readonly and constant?

952


what is session_set_save_handler in PHP?

963


what is difference between PHP4 , PHP5

2330