Blog Introductions

In this  blog contains tutorials about  HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials,  Examples, Source code,Learning,
Tips and Software development  services. Php Arrays and its work  | Php tutorials Bestitworrior


Php Arrays and its work 


Php tutorials






Php Arrays and its work  | Php tutorials Bestitworrior - Arrays are the variable which hold multiple values in one array variable . IF we need to store 10 value in varible then we need to declear 10 variables and then store 10 values in each of them .This is the problem in time consuming to saving time and less effort then we use array one variable to hold all of 10 values.Now array save time and lines of code .Array is easy to iterate sort and munipulate and perform various function on data.


Some Key Points of PHP Arrays

  1. Array hold multiple values in one variable
  2. Easy to code array rather the having multiple variables
  3. Array can sort values
  4. We can use loop to access array values
  5. Arrays same time and lines of code
  6. We can delete or add new values from array
  7. We can modefy array values
  8. Index array use to access by index
  9. Associative array use to access by key

Code



<?php

echo "Index Array Output<br>";
$month = array("january", "feburary", "march");
echo "Months : " . $month[0] . ", " . $month[1] . " and " . $month[2] . ".";


echo "<br>";

$month1 = array("january", "feburary", "march");
$length = count($month1);

for($i = 0; $i < $length; $i++) {
echo $month1[$i];
echo "<br>";
}

echo "<br>";
echo "Associative Arrays<br>";

$month2 = array("Jnauary"=>"1", "Feburary"=>"2", "March"=>"3");
echo "January month number - " . $month2['Jnauary'];


echo "<br>";
$month3 = array("Jnauary"=>"1", "Feburary"=>"2", "March"=>"3");

foreach($month3 as $x => $x_value) {
echo "Key=" . $x . ", Value=" . $x_value;
echo "<br>";
}









?>





OutPut


Index Array Output
Months : january, feburary and march.
january
feburary
march

Associative Arrays
January month number - 1
Key=Jnauary, Value=1
Key=Feburary, Value=2
Key=March, Value=3


I hope You really enjoyed this blog . I try my best to make every thing is easy and helpfull to provide to public .You will get more blog about the Programing project and code . Thanks for visiting my blog if you have any querry related to this you can comment here i will try my best to response you back about Php Arrays and its work  | Php tutorials Bestitworrior