Friday, September 6, 2019

PHP String Functions Part II


PHP String Functions


strlen()
It is used to find length of given string.

Syntax:
strlen(string_variable)

For Example:
$strData = strlen("Welcome india");
echo $strData;

Answer is:
13

strtolower()
It is used to convert a string value in lower case.

Syntax:
strtolower(string_variable);

For Example:
$strData = strtolower("WELCOME INDIA");
echo $strData;

Answer is:
welcome india

strtoupper()
It is used to convert a string value in upper case.

Syntax:
strtoupper(string_variable);

For Example:
$strData = strtoupper("welcome india");
echo $strData;

Answer is:
WELCOME INDIA

substr()
It is used to extract a part of a string value from a specified position.

Syntax:
substr(string_variable, start_pos, string_length)

For Example:
echo substr("Welcome india", 5, 4);

Answer is:
me i

No comments:

Post a Comment