1. Prime Number
";
echo"
Total num of prime num between ".$start." and". $end ."are:.$primecount";
}
$start=1;
$end=10;
displayPrimesInRange($start,$end);
?>
2. Message passing
Message Passing
Page 2
3. Calculator
SImple CAlculator
4. String Functions
";
echo"string1 is:".$str1."
";
echo"string2 is:".$str2."
";
$len=strlen($str1);
echo"the length of the str1 is:".$len;
$word_count=str_word_count($str1);
echo"
the total words of str1 is:".$word_count;
$capitalize=ucwords($str1);
echo"
the uppercase of ecah word is:\n".$capitalize;
$upper=strtoupper($str1);
echo"
the uppercase of string is :\n".$upper;
$reverse=strrev($str1);
echo"the reverse of string is:
".$reverse;
$compare=strcmp($str1,$str2);
echo"
the comparision of str1 and str2 is:".$compare;
$repeate=str_repeat($str1,3);
echo"
".$repeate;
?>
5. Time zone
="12" && $hour<="18:00")
{
echo"Good Afternoon";
}
else if($hour>"18" && $hour<="21")
{
echo"Good Evenning";
}
else if($hour>"21")
{
echo"Good night";
}
?>
1. Array
Minimum number is:".min($arr);
echo "
Maximum number is:".max($arr);
sort($arr);
echo "
The sorted Array is:";
foreach($arr aS $value)
{
echo $value.",";
}
rsort($arr);
echo "
The Reverse sorted array is:";
foreach($arr as $value)
{
echo $value.",";
}
array_pop($arr);
echo "
After pop the array is:";
foreach($arr as $value)
{
echo $value.",";
}
array_push($arr ,'50');
echo "
After push the array is:";
foreach($arr as $value)
{
echo $value.",";
}
?>
2.GCD LCM
GCD and LCM
3. Constructor
a=10;
$this->b=20;
}
function add()
{
$sum=$this->a+$this->b;
echo "Addition of a and b is:".$sum;
}
function __destruct()
{
echo "
Destruct() function is called";
}
function sub()
{
$sub=$this->a-$this->b;
echo "
sub of a and b is:".$sub;
}
}
$object1 = new ArithmaticOperation();
$object1->add();
$object1->sub();
unset($object1);
?>
4.file