Prac 5
Prac 5
Roll No: 63
Practical 5:
•
Calculate length of string.
•
Count the number of words in string without using string
functions. B. Write a simple PHP program to demonstrate use of
various built-in string functions
<?php
$str = "Welcome to the world of PHP";
$length = strlen($str);
echo "<br> Length of string : " . $length; ?
>
Output:
Code: No. of Words in String
<?php
$str = "Hello world";
$count = 1; // Start from 1 because words = spaces + 1
Output: