PR 5 PHP
PR 5 PHP
<html>
<body>
<?php
echostrlen("Koushal")
?>
</body>
</htm l>
Output:
b)countof number of words in string without in string with out using string function
input:
<html>
<body>
<?php
$sequence="beautyliesintheeyeofbeholder";
$wordcount=0;
for($i=0;$i<strlen($sequence)-1;$i++)
if($sequence[$i]==''&&ctype_alpha($sequence[$i+1])&&($i>0))
$wordcount++;
$wordcount++;
print("total numberofwordinthestrings:".$wordcount);
?>
</body>
</htm l>
Output:
c)Built in function of string
input
<html>
<body>
<?php
echostrlen("KoushalKhot"); echo"<br>";
echostr_word_count("KoushalKumarKhot"); echo"<br>";
echostrrev("helloworld"); echo"<br>";
echostrpos("helloworld!","world"); echo"<br>";
echostr_replace("world","Mam","helloworld"); echo"<br>";
echostrtoupper("Technology"); echo"<br>";
echostrtolower("ADITYABUBNE"); echo"<br>";
echostrcmp("helloworld!","helloworld"); echo"<br>";
Output