String Function in PHP

 String Function in php:-

1.strlen(String Length).

2.str_word_count(String Word Count).

3.strpos(String Pos).

4.strrev(String Reverce).

5.str_repleace(String Repleace).

6.str_repeat(String Repeat).

7.rtrim and ltrim (Right and Left Trim).




<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <?php
    $name=" abhay ";
    // string length
    echo 'my length of'.' my string is '.strlen($name).'.';
    echo "<br>";
    echo "<br>";
    echo 'my name is character letter '.strlen($name);
    echo "<br>";
    echo "<br>";

    // string word count
    $p='Lorem ipsum dolor sit amet consectetur adipisicing elit. Id nesciunt eveniet voluptatum explicabo non doloribus fugiat vero. Enim, molestiae vero?';
    echo str_word_count($p);
    echo "<br>";
    echo "<br>";

    // string pos
    echo strrev($p);
    echo "<br>";

    // string repleace
    echo str_replace("Id","Abhay",$p);
    echo "<br>";
    echo "<br>";
   

    // sting repeat
    echo str_repeat($name,20);
    echo "<br>";
    echo "<br>";
   
    // ringt trim

    echo ltrim('       ajdhilasvj ihoihfoi hjij       ');
    echo "<br>";
    echo "<br>";


    // string pos
    echo strpos($p,'Id');
   
   
    ?>
</body>
</html>

OUTPUT:--







إرسال تعليق

Post a Comment (0)

أحدث أقدم