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 difference Between PHP 5 and 7?

1191


Does cors prevent csrf?

1010


Is empty check in php?

1102


How can you retrieve a cookie value?

1142


What is putenv?

1066


What should we do to be able to export data into an excel file?

1070


Tell me what are the functions to be used to get the image's properties (size, width and height)?

1096


What is difference between required and include in php?

993


What is the use of pear in php?

1076


How to get useful error messages in php?

1094


What is PHP's configuration file called?

1229


How to make a class in php?

1021


How to remove duplicate values from php array?

1190


Explain the value of the variable input is a string 1,2,3,4,5,6,7. How would you get the sum of the integers contained inside input?

1026


What is final in php?

1164