# 1.Display prime no.
";
for($i=$start; $i<$send; $i++)
{
if(isPrime($i))
{
echo $i."";
$count++;
}
}
echo "
total prime no. between $start and $end:
".$count;
}
$start=1;
$end=10;
displayPrimeInRange($start,$end);
?>
#2 message passing
Message passing
#3.simple calculator
simple calculator
#4. string function
";
$str1="Change your thoughts and you can change the world";
$str2="The first programmer was women";
echo "The given string are:
";
echo "String 1 is: $str1
";
echo "String 2 is: $str2
";
$len=strlen($str1);
echo "The length of string 1 is: $len";
$word_count=str_word_count($str1);
echo "
The total word of string 1 is: ".$word_count;
$capitalized=ucwords($str1);
echo "
Uppercase of each word is:\n ".$capitalized;
$upper=strtoupper($str1);
echo "
The upper case of String is:\n $upper";
$reverse=strrev($str1);
echo "
The reverse of string is:\n $reverse";
$compare=strcmp($str1, $str2);
echo nl2br("
The comparision of string 1 and string 2 is:\n $compare");
$repeate=str_repeat($str1,3);
echo "
Repetation: \n $repeate";
?>
#5. Display time
date_default_timezone_set('Asia/Calcutta');
$hour=date('G');
echo "the currrent time is (In 24 hr format):".$Hour."-";
if($Hour<"12")
{
echo "Good Morning"'
}
else if("Hour >="12" && &Hour <="18:00")
{
echo "Good afternoon";
}
else if("Hour >="18" && &Hour <="21")
{
echo "Good evening";
}
else if("Hour >="21" && &Hour <="21")
{
echo "Good night";
}
?>