0% found this document useful (0 votes)
3 views3 pages

PR 5 PHP

Uploaded by

khotk720
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

PR 5 PHP

Uploaded by

khotk720
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Practical no 5

Name : Koushal Kumar Khot Rollno: 28

Q.Write a php programs

a) .Calculate the string length


Input

<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>";

echoucwords("welcometoW eb"); echo"<br>";

echostrtoupper("Technology"); echo"<br>";

echostrtolower("ADITYABUBNE"); echo"<br>";

echostr_repeat("HIII ",10); echo"<br>";

echostrcmp("helloworld!","helloworld"); echo"<br>";

?> </body> </html>

Output

You might also like