Subscribe To Our Newsletter

Sign Up Now To Get Free Coupon Codes, Event Coupon Codes Updates, Offers Updates. It's 100% Free!

We Hate Spam! Really, It's terrible and we never do it.

PHP Array Important Functions : 8th Day Lecture of PHP

array functions in php

PHP Array Important Functions

PHP array_fill Function and its usage

Array ( [3] => Sheikh Ansari [4] => Sheikh Ansari [5] => Sheikh Ansari [6] => Sheikh Ansari )

PHP array_pop Function and its usage

Sheikh

PHP array_push Function and its usage

Array ( [0] => Samee [1] => ullah [2] => Feroz [3] => Sheikh )

PHP array_reverse Function and its usage

Array ( [0] => Sheikh [1] => Feroz [2] => Ullah [3] => Samee )

PHP array_search Function and its usage

2

PHP array_slice Function and its usage

Array ( [0] => Feroz [1] => Sheikh [2] => Ansari )
Array ( [0] => Feroz [1] => Sheikh )

PHP array_unique Function and its usage

Array ( [0] => Samee [1] => Ullah [2] => 3 [3] => Sheikh )

PHP count Function and its usage

5

PHP current Function and its usage

Samee

PHP next Function and its usage

Ullah
Feroz

PHP reset Function and its usage

Samee
Feroz
Samee

PHP shuffle Function and its usage

Array ( [0] => Sheikh [1] => Ansari [2] => Samee [3] => Feroz [4] => Ullah )

 <html>  
   <head>  
     <title><?php $pagetitle="PHP Array Important Functions ";  
                               define("blogname","Samee Articles");  
                          echo $pagetitle . ":" . blogname ?></title>  
         <meta name="description" content="<?php echo $pagetitle ?>" />  
         <meta name="robots" value="nofollow, noindex" />  
     <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="stylesheet.css" rel="stylesheet" />  
   </head>  
   <body>  
        <div id="main">  
       <img id="logo" src="http://icons.iconarchive.com/icons/deleket/3d-cartoon-vol3/256/Web-Coding-icon.png" alt="Coding">  
           <?php  
                               function b()  
                               {  
                               echo "<br />";  
                               }  
                          ?>  
       <h1 align="center"><?php echo $pagetitle ?></h1>  
          <h2 align="left">PHP array_fill Function and its usage</h2>  
                          <?php  
                $emp = array();  
                               $emp=array_fill(3,4,"Sheikh Ansari"); //it is used to fill the array ; 3rd value and remaining 4 values  
                               print_r($emp);  
                               b();  
                          ?>  
         <h2 align="left">PHP array_pop Function and its usage</h2>  
           <?php  
             $str = array("Samee","ullah","Sheikh");  
                               echo array_pop($str); //it is used delete the last element of the error and show it.  
                               b();  
                          ?>  
         <h2 align="left">PHP array_push Function and its usage</h2>  
           <?php  
             $str = array("Samee","ullah","Feroz");  
                               array_push($str,"Sheikh"); //it is used return the last value end of the array  
                               print_r($str);  
                               b();  
                          ?>  
         <h2 align="left">PHP array_reverse Function and its usage</h2>  
           <?php  
             $str = array("Samee","Ullah","Feroz", "Sheikh");  
                               $name = array_reverse($str); //1st you need to asign complete array to an other variable; then you need to print out that array  
                               print_r($name);  
                               b();  
                          ?>  
         <h2 align="left">PHP array_search Function and its usage</h2>  
           <?php  
             $str = array("Samee","Ullah","Feroz", "Sheikh");  
                               echo array_search("Feroz",$str); //It is used to find th element in array.  
                               b();  
                          ?>  
          <h2 align="left">PHP array_slice Function and its usage</h2>  
           <?php  
             $str = array("Samee","Ullah","Feroz", "Sheikh", "Ansari");  
                               print_r (array_slice($str, 2)); //It is used to make a slice from 2nd value to end  
                               b();  
                               $str = array("Samee","Ullah","Feroz", "Sheikh");  
                               print_r (array_slice($str, 2, 3)); //It is used to make a slice from 2nd value to 3rd value  
                               b();  
                          ?>  
         <h2 align="left">PHP array_unique Function and its usage</h2>  
           <?php  
             $str = array("Samee","Ullah",3, "Sheikh", "Samee");  
                               print_r (array_unique($str)); //It is used to remove duplicate value in the array  
                               b();  
                          ?>  
         <h2 align="left">PHP count Function and its usage</h2>  
           <?php  
             $str = array("Samee","Ullah",3, "Sheikh", "Samee");  
                               print_r (count($str)); //It is used to count the values in array  
                               b();  
                          ?>  
         <h2 align="left">PHP current Function and its usage</h2>  
           <?php  
             $str = array("Samee","Ullah",3, "Sheikh", "Samee");  
                               print_r (current($str)); //It is used to print 1st value of the array  
                               b();  
                          ?>  
         <h2 align="left">PHP next Function and its usage</h2>  
           <?php  
             $str = array("Samee","Ullah","Feroz", "Sheikh", "Ansari");  
                               print_r (next($str)); //It is used to print (2nd value) next to 1st value of the array  
                               b();  
                               print_r (next($str)); //It is used to print (3rd value) next to next to 1st value of the array  
                               b();  
                          ?>  
         <h2 align="left">PHP reset Function and its usage</h2>  
           <?php  
                               $array = array('Samee', 'Ullah', 'Feroz', 'Ansari');  
                               echo current($array) . "<br />\n"; //1st element  
                               next($array);  
                               next($array); // skip two steps  
                               echo current($array) . "<br />\n";  
                               reset($array); //reset is used to reset the array elements.   
                               echo current($array) . "<br />\n";   
                               b();  
                          ?>  
         <h2 align="left">PHP shuffle Function and its usage</h2>  
           <?php  
             $str = array("Samee","Ullah","Feroz", "Sheikh", "Ansari");  
                               shuffle($str); //It will shuffle array elements on every refresh  
                               print_r ($str);  
                          ?>   
   </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 Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe Samee Articles blog.

---------------------------------------
Thanks for visiting QWC.Me.
==========================================
For free guidelines contact me on SEO Expert | Samee Ullah Feroz is online there.
==========================================
Best Regards

 
Support : | Internet Marketing Specialist And Business Developer
Copyright © 2013-2016. Samee Articles - All Rights Reserved
Proudly powered by Blogger