Program 1
<html>
<head><title>Array in PHP Application</title>
<body>
<pre>
<center>
<?php
$numbers=array(10,5,6,12,56,77,89);
$s=12;
$temp=false;
for($i=0;$i<count($numbers);$i++)
{
if($s==$numbers[$i])
{
$temp=true;
break;
}
}
if($temp==true)
echo "<br><font color=green size=5> Searching success</font>";
else
echo "<br><font color=red size=5> Element not found</font>";
?>
</pre>
</center>
</body>
</html>
Program 2
<html>
<head><title>Array Sorting in PHP Application</title>
<body>
<pre>
<center>
<?php
$numbers=array(10,5,6,12,56,77,89);
for($i=0;$i<count($numbers);$i++)
{
for($j=$i+1;$j<count($numbers);$j++)
{
if($numbers[$j]<$numbers[$i])
{
$temp=$numbers[$i];
$numbers[$i]=$numbers[$j];
$numbers[$j]=$temp;
}
}
}
echo "<br> Sorted elements : ";
for($i=0;$i<count($numbers);$i++)
{
echo "<br>".$numbers[$i];
}
?>
</pre>
</center>
</body>
</html>