How to use string function in php

Description
Here i explain how to use php string functions with syntax and example like following below:

  • how to convert  lowercase latter to uppercase letter in php:
            Syntax :

                strtoupper(variable name);

            Example:

               < ?php
                              $a=“hello”;
                              echo strtoupper($a);
                        ?>



  • how to convert  
  • uppercase 
  • latter to 
  • lowercase 
  • letter
  •  in php:
              Syntax :

                strtolower(variable name);

             Example:

               < ?php
                              $a=“HELLO”;
                              echo strtolower($a);
                        ?>

  • how to Count String Length in php:
             Syntax :

                strlen(variable name);

             Example:

               < ?php
                              $a=“hello”;
                              echo strlen($a);
                        ?>

  • how  to  Print Reverse String in php:
              Syntax :

                strrev(variable name);

             Example:

               < ?php
                              $a=“hello”;
                              echo strrev($a);
                        ?>

  • how  to  replace String in php:
              Syntax :

                strrev(variable name);

             Example:

               < ?php
                             $a=“hello php”;
                             echo str_replace(“hello”,”world”,$a);
                        ?>


                          



No comments:

Post a Comment