How To Use Php String Function Example

03-Apr-2023

.

Admin

How To Use Php String Function Example

Hi guys,

Today i will explained how to use php String function in your php file. This example is so easy to use in php. This example to i am use in many string function in php file.

THe string function is provided in a php in by default. String function use to vary easy here.

This example to i am use in strlen,str_word_count,strrev,strpos,and str_replace function used in this tutorial. So you are follow for my step by step.

So let's start to the example.

Strlen


This function is use to checke in length of a string.

<?php

echo strlen("Hello world!");

?>

Str_word_count

THis function is count to the number of the string word.

<?php

echo str_word_count("Hello world!");

?>

Strrev

THis function is use to string value to reverse.

<?php

echo strrev("Hello world!");

?>

Strpos

THis function is return to the position of string.

<?php

echo strpos("Hello world!", "world");

?>

Str_replace

This function work to the string value to replace in another value.

<?php

echo str_replace("world", "Dolly", "Hello world!");

?>

now you can check your own.

i hope it can help you...

#PHP 8

#PHP