Showing posts with label in_array in php. Show all posts
Showing posts with label in_array in php. Show all posts

How can check value exit in an array

How can check value exit in an array


 in_array function can use to check value exit in an array


example
<?php
$value1 
= array("test","test1","test2","test4"); $new_value1="test1";
if (
in_array($new_value1,$value1)) { echo "$newvalue is already in the array!"; } ?> 

how can check value exit in array

how can check value exit in array


<?php
$value = array("one","two","three","four");
$new_value = "five";
if (in_array($newvalue,$values)) { echo "$newvalue is already in the array!"; }
?>