Featured Post Today
print this page
Latest Post

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>  



0 comments

PHP Conditional Statements : If Else If Statements : 7th Day Lecture of PHP



PHP Conditional Statements : If Else If Statements

What is PHP Conditional Statements?

when you write code, you want to perform different actions for different decisions.
You can use conditional statements in your code to do this
  1. If : executes some code only if a specified condition is true
  2. if...else statement - executes some code if a condition is true and another code if the condition is false
  3. if...elseif....else statement - selects one of several blocks of code to be executed

If Example

if...else Example

Have a good night!

if...elseif....else else Example

Have a good night!

 <html>  
   <head>  
     <title><?php $pagetitle="PHP Conditional Statements : If Else If Statements";  
                               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">  
       <h1 align="center"><?php echo $pagetitle ?></h1>  
          <h2 align="left">What is PHP Conditional Statements?</h2>  
           <?php  
             echo "when you write code, you want to perform different actions for different decisions.<br>  
                               You can use conditional statements in your code to do this";  
                               echo "<ol type=\"A\">  
                                         <li>If : executes some code only if a specified condition is true</li>  
                                         <li>if...else statement - executes some code if a condition is true and another code if the condition is false</li>  
                                         <li>if...elseif....else statement - selects one of several blocks of code to be executed</li>  
                                         </ol>";  
           ?>   
          <h2 align="left">If Example</h2>  
           <?php  
                               $t=date("H");  
                               if ($t<"20")  
                                {  
                                echo "Have a good day!";  
                                }  
           ?>   
          <h2 align="left">if...else Example</h2>  
           <?php  
                               $t=date("H");  
                               if ($t<"20")  
                                {  
                                echo "Have a good day!";  
                                }  
                               else  
                                {  
                                echo "Have a good night!";  
                                }  
                          ?>  
         <h2 align="left">if...elseif....else else Example</h2>  
           <?php  
                               $t=date("H");  
                               if ($t<"10")  
                                {  
                                echo "Have a good morning!";  
                                }  
                               elseif ($t<"20")  
                                {  
                                echo "Have a good day!";  
                                }  
                               else  
                                {  
                                echo "Have a good night!";  
                                }  
                          ?>  
     <div id="sidebar">  
       <ul>  
            <li><?php echo "<a href=\"http://sameearticles.blogspot.com\">blogname</a>"?></li>  
         <li><a href="http://www.blogger.com/home">Blogger</a></li>  
         <li><a href="http://sameearticles.blogspot.com/search/label/PHP%20Learning">PHP Learning</a></li>  
         <li><a href="http://seoacquire.blogspot.com">SEO Knowledge</a></li>  
         <li>CSS Learning</li>  
       </ul>  
           </div>    
   </body>  
 </html>  


0 comments

Array Types in PHP : 7th Day Lecture of PHP


php arrays

Types of Array In PHP : Samee Articles

Sample 1 : Types of Array in PHP.

Types of Array In PHP
  1. Indexed arrays - Arrays with numeric index
  2. Associative arrays - Arrays with named keys
  3. Multidimensional arrays - Arrays containing one or more arrays

Sample 2 : Indexed Arrays Example And Use in PHP.

My 1st name is Samee.
My Last Name is Feroz
My Cast is Sheikh.
array (size=4)
  0 => string 'Samee' (length=5)
  1 => string 'Ullah' (length=5)
  2 => string 'Feroz' (length=5)
  3 => string 'Sheikh' (length=6)
Values in Array = 4

Sample 3 : Associative arrays Example And Use in PHP.

My 1st name is Samee .
My Last Name is Feroz
My Cast is Sheikh.
array (size=4)
  'firstname' => string 'Samee' (length=5)
  'middlename' => string 'Ullah' (length=5)
  'lastname' => string 'Feroz' (length=5)
  'cast' => string 'Sheikh' (length=6)

Sample 4 : Multidimensional arrays arrays Example And Use in PHP.

array (size=2)
  0 => 
    array (size=4)
      0 => string 'Samee' (length=5)
      1 => string 'Ullah' (length=5)
      2 => 
        array (size=1)
          0 => string 'Sheikh' (length=6)
      'cast' => string 'Sheikh' (length=6)
  1 => string 'Feroz' (length=5)
My 1st name last part is Ullah

 <html>  
   <head>  
     <title><?php $pagetitle="Types of Array In PHP : 6th Day Lecture : Samee";  
                          echo $pagetitle; ?></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="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">Types of Array In PHP : <a href="http://sameearticles.blogspot.com" target="_blank">Samee Articles</a></h1>  
       <h2 align="left">Sample 1 : Types of Array in PHP.</h2>  
         <?php  
                          echo "Types of Array In PHP <br />";  
                          echo  
                          "<ol type=\"a\">  
                          <li>Indexed arrays - Arrays with numeric index</li>  
                          <li>Associative arrays - Arrays with named keys</li>  
                          <li>Multidimensional arrays - Arrays containing one or more arrays</li>  
                          </ol> <br />";  
         ?>  
       <h2 align="left">Sample 2 : Indexed Arrays Example And Use in PHP.</h2>  
         <?php  
                          $name = array("Samee", "Ullah", "Feroz"); //It is the way to add an index array  
                          $name[3]="Sheikh"; //It is the way to add a value to 3rd number of array, it is custom way  
                          echo "My 1st name is $name[0]. <br />";  
                          echo "My Last Name is " . $name[2] . "<br />";  
                          echo "My Cast is {$name[3]}. <br>";  
                          var_dump($name);  
                          echo "Values in Array = \t" . count($name); //this function is for counting the values of Array  
         ?>  
       <h2 align="left">Sample 3 : Associative arrays Example And Use in PHP.</h2>  
         <?php  
                          $name = array("firstname"=>"Samee","middlename"=>"Ullah","lastname"=>"Feroz"); #It is the way to add an assosiative array  
                          $name['cast'] = "Sheikh"; //you can use double or single qoutes both methods with in []  
                          echo "My 1st name is {$name["firstname"]} . <br />";  
                          echo "My Last Name is " . $name["lastname"] . "<br />";  
                          echo "My Cast is {$name["cast"]}. <br>";  
                          var_dump($name);  
         ?>  
       <h2 align="left">Sample 4 : Multidimensional arrays arrays Example And Use in PHP.</h2>  
         <?php  
                          $name= array(array("Samee","Ullah"),"Feroz"); //array within array is called multidimensional array  
                          /*$name[0][2][0]="Sheikh";*/ //1st way to write one integer between array  
                          $name[0]["cast"]="Sheikh"; //2nd way to write one integer between array  
                          var_dump($name);  
                          echo "My 1st name last part is ". $name[0][1]; //it is used to find the path  
         ?>  
   </body>  
 </html>  

0 comments

Some Important Mathematics Fucntions In PHP : 6th Day Lecture


power function

Some Important Mathematics Functions In PHP

Sample 1 : Example of Float.

Absolute Function Code
295
Power Function Code
6561
Square Root Function Code
10
Mod Function Code
6
3.8745
Random Value Function Code
1877
7

 <html lang="en">  
   <head>  
     <title><?php $pagetitle="Some Important Mathematics Functions In PHP : 6th Day Lecture : Samee";  
                          echo $pagetitle; ?></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="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 Mathematics Fucntions In PHP : <a href="http://sameearticles.blogspot.com" target="_blank">Samee Articles</a></h1>  
       <h2 align="left">Sample 1 : Example of Float.</h2>  
         <?php  
                          echo "Absolute Function Code <br />";  
                          echo abs(5 - 300) . "<br />";  
                          echo "Power Function Code <br />";  
                          echo pow(3, 8) . "<br />";  
                          echo "Square Root Function Code <br />";  
                          echo sqrt(100) . "<br />";  
                          echo "Mod Function Code <br />";  
                          echo fmod(20, 7) . "<br />";  
                          echo fmod(3.8745, 40.45523) . "<br />";  
                          echo "Random Value Function Code <br />";  
                          echo rand() . "<br />";  
                          echo rand(5,10) . "<br />";  
         ?>  
   </body>  
 </html>  


0 comments

Float Different Functions In PHP : 6th Day Lecture : Samee



Float Different Functions In PHP

Sample 1 : Example of Float.

float 3.584

Sample 2 : Different Functions Examples to show Float Values

float 3.684
4
3.68
3
4

 <html>  
   <head>  
     <title><?php $pagetitle="Float Different Functions In PHP : 6th Day Lecture : Samee";  
                          echo $pagetitle; ?></title>  
         <meta name="description" content="<?php $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="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">Float Diffirent Functions In PHP : <a href="http://sameearticles.blogspot.com" target="_blank">Samee Articles</a></h1>  
       <h2 align="left">Sample 1 : Example of Float.</h2>  
         <?php  
                          $float=3.58400;  
                           var_dump($float)  
         ?>  
       <h2 align="left">Sample 2 : Different Functions Examples to show Float Values</h2>  
         <?php  
                          $float=3.684000000;  
                           var_dump($float); //It is to show the value is float  
                           echo round($float) . "<br />"; //it is used to increase the value to 4 as mathematics rules.   
                           echo round($float,2) . "<br />"; //it is used to increase the value after point and 2 digit as mathematics rules.  
                           echo floor($float) . "<br />"; //it is used to increase the value according to complete value  
                           echo ceil($float) . "<br />"; //it is used to increase the value to 4 as mathematics rules.   
         ?>  
   </body>  
 </html>  


0 comments

Define Constants in PHP : 6th Day Lecture : Samee


define php constant

Constants In PHP : Samee Articles

Sample 1 : What is Constant in PHP?

Constant is a identifier for a simple value.
The Value can not be changed during the script.
Value starts with letter or underscore, never with dollar sign "$".
It starts with "define."
Constant is default Case Sensitive.

Sample 2 : Constant Example in PHP

My Name is Samee Ullah Feroz.

Sample 3 : Constant Example in PHP

My Nick Name is Sherri Bhai.

 <html>  
   <head>  
     <title>Constants in PHP : 6th 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" />  
     <meta name="robots" value="nofollow, noindex" />  
   </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">Constants In PHP : <a href="http://sameearticles.blogspot.com" target="_blank">Samee Articles</a></h1>  
       <h2 align="left">Sample 1 : What is Constant in PHP?</h2>  
         <?php  
                          echo 'Constant is a identifier for a simple value. <br /> The Value can not be changed during the script. <br /> Value starts with letter or underscore, never with dollar sign "$". <br /> It starts with "define." <br /> Contant is defauld Case Sansitive.';  
         ?>  
       <h2 align="left">Sample 2 : Constant Example in PHP</h2>  
         <?php  
                          define("name","My Name is Samee Ullah Feroz."); //here it is case sansitive.   
                          echo name;  
                          /*echo Name;*/ //Here is an error due to case sensitivity  
         ?>  
       <h2 align="left">Sample 3 : Constant Example in PHP</h2>  
         <?php  
                          define("name2","My Nick Name is Sherri Bhai.",true); //here it is not case sensitive.   
                          echo Name2; //Here it is not sensitive due to "true" word  
         ?>  
   </body>  
 </html>  


0 comments
 
Copyright © 2011-2026. Samee Articles - All Rights Reserved
Proudly powered by Blogger