Assignment For Improvement-IWP
Assignment For Improvement-IWP
18BCE0557 KUSHAL
1. Display the months of the year using associative arrays in the following format “January is the
First month” and so on for all the months.
<?php
$months = array("First"=>"January", "Second"=>"February",
"Third"=>"March", "Fourth"=>"April", "Fifth"=> "May", "Sixth"=>"June",
"Seventh"=> "July", "
Eighth"=>"August", "Ninth"=>"September",
"Tenth"=>"October", " Eleventh"=>"November", "Twelfth"=>"December");
<center>";
echo "
echo " </br></br></br></br>";
foreach($months as $order => $month) {
echo "<b>". $month ." is the ". $order ." month </b>";
echo "</br></br>";
}
echo "</center>";
?>
a) Display only the unique characters present in the string “I like PHP and MySQL!”
c) In the string “Hello Class! It is an interesting class”, replace class with “world” irrespective of the
case.
d) Count the number of times “over” is occurs in the string “Over the hills and over the mountains..
over and over again they went”.
a)
<?php
?>
b)
<?php
$str="Red#Blue#Yellow#Green";
print_r (explode("#", $str));
?>
c)
<?php
$str1 = "Hello Class! It is an interesting class";
echo str_ireplace("class","world",$str1);
?>
d)
<?php
$str = "Over the hills and over the mountains.. over and over again they
went";
?>
e)
<?php
echo "</br></br>";
?>