String Function | PHP

String Function


<!DOCTYPE html>

<html>

<head>

    <title></title>

    <style>

        h1{

            text-align:center;

            color:red;

            background-color: black;

            padding:20px;   

        }    

        body{

            background-color:blanchedalmond;

        }

    </style>

</head>

<body>

<h1>String Function</h1>

<?php

    $a=5;

    $b=85;

    $c=9;

    $d=($a*$b)%$c;

    echo "1. Arithmetic Oparetor value int:- ".($d)."<hr>";

//concatenate   

    $name="shuvadeep";

    $age=24;

    $address="Bhubaneswar";


    echo "2. concatenate(.):- My name is ".$name." and i am ".$age." i am from " .$address."."."<hr>";

//string length

    $a=("shuvadeep");   

    echo "3. string length:- ".strlen($a)."<hr>";

//string wordcount

    $a=("my name is shuvadeep");

    echo "4. string wordcount:- ".str_word_count($a)."<hr>";

//string revers

    $a=("my name is shuvadeep");

    echo "5. string revers:- ".strrev($a)."<hr>";


//String position

    $a=("my name is shuvadeep");

    echo "6. String position:- ".strpos($a, "shuvadeep")."<hr>";


//string repleace

    $w= "hello shuvadeep";

    $a="x";

    $c="shuvadeep";

    echo "7. string repleace:- ".str_replace($c, $a, $w). "string repleace";

    echo "<hr>"

   

/*explode

    $new="i am learning PHP";

    print_r(explode (" ",$new));

    echo "<hr>"*/

?>

<?php

    $name = "shuvadeep";

    echo "hello my name is ".($name)." and yours.";

    echo "<hr>";

    echo "8. this is String length:- ".strlen("shuvadeep");

    echo "<hr>";


    $new="i am learning PHP";

    print_r (explode (" ",$new));

    echo "(9. explode)"."<hr>"

?>

</body>

</html>


Output ScreenShot



Comments

Popular posts from this blog

C.R.U.D Oparetion in (PHP Code)

Search Dropdown - jQuery

JavaScript Form Validation Code