php_prac_5
php_prac_5
5
1. Write a program to develop string functions.
<?php
$str="hello php";
$arr=array("blue","red","pink");
echo "<br>";
echo "<br>";
echo "<br>";
echo strpos($str,"php");
echo "<br>";
print_r (str_replace("red","yellow",$arr));
echo "<br>";
echo "<br>";
echo strtolower("HELLO");
echo "<br>";
echo "<br>";
?>
Output
<?php
$str="hello php";
$arr=array("blue","red","pink");
?>
Output:
3. Write a program to count the number of words in string without using string functions
<?php
?>
Output: