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.
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example