Skip to main content

PHP Search In Array Using in array Function





Code:

<form action="" method="post">

<input type="text" name="data" />

<input type="submit" name="submit" value="Search" />

</form>



<?php

if(isset($_POST['submit'])){

$search = $_POST['data'];

$array = array('USA','Uk','Canada','France');

if(in_array($search,$array)){

print "The input exists in Array";



}

else {

print "The input does not Exists in Array";



}



}



?>

Comments

Popular posts from this blog

PHP Type Casting in Bangla Language

Code: <?php print $x =(int)78.9; print "<br />"; print $y = (float)87; $z = (array)90; print "<br />"; print $z[0]; ?>

Factorial Using PHP In Bangla

Code: <form action="" method="post"> Enter Number : <input type="text" name="num" /> <input type="submit" name="submit" value="Submit" /> </form> <?php if(isset($_POST['submit'])){ $num = $_POST['num']; $fact = 1; for($i=2;$i>=1;$i--){ $fact *= $i; } print "The Factorial is: ".$fact; } ?>

PHP Function part3

Code: <?php function xyz($x,$y){ $z = $x + $y; return $z; } $b = xyz(10,20); print $b; function xyz1(){ $z[] = "he"; $z[] = "she"; $z[] = "me"; return $z; } list($x,$y,$z) = xyz1(); print "<br />"; print $x." ".$y." ".$z; ?>