PHP Strings

php-strings

PHP Strings is very interesting part in PHP. A PHP String is a series of characters, where character is same as byte.

See Some Example for get more knowledge : HOW IT WORKS..

a) PHP String Length Function

The PHP strlen() function returns the length of string

<?php
echo strlen(“Hello India!!”);
?>

Output: 13


b) PHP String Position Function

The strpos() function is use to search for a string or any character into string.

<?php
echo strpos(“Hello ontime”,“ontime”);
?>

Output: 6


c) PHP String – Replace text

he PHP str_replace() function replace characters with other characters into string

<?php
echo str_replace(“World“, “Asia”, “Hello World”);
?>

Output: Hello Asia    // (In this example through PHP String Replace Text, World replaces with Asia


Yogesh Khanna

onTime IT Solution always happy to serve you in Information Technology (IT). Learn HTML, CSS, Javascript, PHP, Android, Digital Marketing, Latest IT News and many more.

Leave a Reply

Your email address will not be published. Required fields are marked *