php.5
php.5
<html>
<body>
<?php
$word="Gauri";
echo"<br>string is :=> $word</br>";
echo"<br>length of words:=>".strlen($word)."</br>";
?>
</body>
</html>
OUTPUT:
Write a program to count number of words in string without using string function.
<?php
function word($string)
{
return count(explode(" ", trim($string)));
}
$mystr = "I am Gauri";
$mylen = word($mystr);
echo "</br>Given string: " . $mystr;
echo "</br>Number of words in string: " . $mylen;
?>
OUTPUT:
Write a program to demonstrate PHP maths function.
<?php
echo"Absoulte Values:=>".abs(-10)."<br>";
echo"Square Root:=>".sqrt(8)."<br>";
echo"Maximum number:=>".max(10,20,30)."<br>";
echo"Minimum Number:=>".min(10,20,30)."<br>";
echo"Floor Value:=>".floor(3.10)."<br>";
echo"Power Function:=>".pow(2,3)."<br>";
?>
OUTPUT: