Some Important Functions of PHP : 5th Day Lecture of PHP : Samee


php strings

Some Important Functions of PHP

Sample 1 : strpos() Function Usage

As $name2 is "Feroz"
12
it will used to show the value location of starting $name2

Sample 2 : strlen() Function Usage

As $name1 is "Samee Ullah Feroz"
17= it will used to show the lenght of String $name1

Sample 3 : strtolower() Function Usage

samee ullah feroz

Sample 4 : strtoupper() Function Usage

SAMEE ULLAH FEROZ

Sample 5 : ucfirst() Function Usage

Samee ullah feroz

Sample 6 : ucwords() Function Usage

Samee Ullah Feroz

Sample 7 : implode() Function Usage

Samee_Ullah_Feroz

Sample 8 : explode() Function Usage

array (size=3)
  0 => string 'Samee' (length=5)
  1 => string 'Ullah' (length=5)
  2 => string 'Feroz' (length=5)

Sample 9 : substr() Function Usage


Ullah Feroz
Feroz
oz

Samee Ullah Feroz
Feroz
eroz
e Ullah Feroz

 <html>  
   <head>  
     <title>Some Important Functions of PHP : 5th Day Lecture : Samee</title>  
     <link rel="icon" type="image/ico" href="http://www.iconarchive.com/download/i50954/deleket/3d-cartoon-vol3/Web-Coding.ico" alt="Icon" />  
     <link type="text/css" href="http://www.getacho.com/download/phpcss/stylesheet.css" rel="stylesheet" />  
   </head>  
   <body>  
        <img id="logo" src="http://icons.iconarchive.com/icons/deleket/3d-cartoon-vol3/256/Web-Coding-icon.png" alt="Coding">  
     <h1 align="center">Some Important Functions of PHP : <a href="http://sameearticles.blogspot.com" target="_blank">Samee Articles</a></h1>  
       <h2 align="left">Sample 1 : strpos() Function Usage</h2>  
         <?php  
                          $name1 = "Samee Ullah Feroz";  
                          $name2 = "Feroz";  
                          echo 'As $name2 is "Feroz"<br />';  
                          echo strpos($name1, $name2) . "<br />it will used to show the value location of starting \$name2"  
         ?>  
       <h2 align="left">Sample 2 : strlen() Function Usage</h2>  
         <?php  
                          $name1 = "Samee Ullah Feroz";  
                          $name2 = "Feroz";  
                          echo 'As $name1 is "Samee Ullah Feroz"<br />';  
                          echo strlen("$name1") . "=\tit will used to show the lenght of String \$name1";  
                          //And We can also write Full Name in the place of $name1 and also we can write string either with double qoutes or without qoutes  
         ?>  
       <h2 align="left">Sample 3 : strtolower() Function Usage</h2>  
         <?php  
                          $name1 = "Samee Ullah Feroz";  
                          $name2 = "Feroz";  
                          echo strtolower($name1); //As it is used to convert all letters to lower case.  
         ?>  
       <h2 align="left">Sample 4 : strtoupper() Function Usage</h2>  
         <?php  
                          $name1 = "Samee Ullah Feroz";  
                          $name2 = "Feroz";  
                          echo strtoupper($name1); //As it is used to Convert all letters to upper case (Capital Letters)  
         ?>  
       <h2 align="left">Sample 5 : ucfirst() Function Usage</h2>  
         <?php  
                          $name1 = "samee ullah feroz";  
                          $name2 = "Feroz";  
                          echo ucfirst($name1); //As it is used to Convert 1st letter to upper case (Capital Letter)  
         ?>  
       <h2 align="left">Sample 6 : ucwords() Function Usage</h2>  
         <?php  
                          $name1 = "samee ullah feroz";  
                          $name2 = "Feroz";  
                          echo ucwords($name1); //As it is used to Convert each 1st letter to upper case (Capital Letters)  
         ?>  
       <h2 align="left">Sample 7 : implode() Function Usage</h2>  
         <?php  
                          $name1 = array("Samee","Ullah","Feroz");  
                          $name2 = "Feroz";  
                          echo implode("_",$name1); //As it is used to join the array values and add specific charactor among each value.  
         ?>  
       <h2 align="left">Sample 8 : explode() Function Usage</h2>  
         <?php  
                          $name1 = "Samee Ullah Feroz";  
                          $name2 = "Feroz";  
                          $name3 = explode(" ",$name1);  
                          var_dump($name3);  
         ?>  
       <h2 align="left">Sample 9 : substr() Function Usage</h2>  
         <?php  
                          echo substr("Samee Ullah Feroz",18)."<br />";  
                          echo substr("Samee Ullah Feroz",6)."<br />";  
                          echo substr("Samee Ullah Feroz",11)."<br />";  
                          echo substr("Samee Ullah Feroz",15)."<br />";  
                          echo "<br>";  
                          // Negative numbers:  
                          echo substr("Samee Ullah Feroz",-18)."<br />";  
                          echo substr("Samee Ullah Feroz",-6)."<br />";  
                          echo substr("Samee Ullah Feroz",-4)."<br />";  
                          echo substr("Samee Ullah Feroz",-13)."<br />";  
         ?>  
   </body>  
 </html>  


Share this article :

Post a Comment

Give your reviews about this blog. Leave your comments. What do you think about this post?

Comments Guidelines:

1) I love to read comments, but please avoid spam.

2) Like this blog, share your insights, and spread the word.

3) You can use basic HTML/xHTML tags.

4) All comments are DoFollow—please use the section professionally.

5) Kindly mention your name or brand below your comment.

6) Constructive suggestions for improvement are always welcome.

7) Do not forget to explore our main agency platform at pingbooster.site.

Thanks for visiting Samee Articles.

========================================

Explore custom digital solutions and WordPress plugins at PingBooster Plugins.

Best Regards,

Samee U. Feroz

 
Copyright © 2013-2016. Samee Articles - All Rights Reserved
Proudly powered by Blogger