Breaking

LightBlog

Saturday 4 July 2015

Numeric Array in PHP


These arrays can store numbers, string and any object but their index will be prep resented by number. By default array index start from zero. Array can most easily be described as an ordered list of elements. You can access the individual element by referring to their index position within the array. The position is either specified numerically or by name. An Array with a numeric index is commonly called an indexed array .
For example 
                                     


<html>
<body>
//First method to create array
<?php
$number =array (10, 20, 30, 40, 50, 60, 70);
foreach($number as $value )
{
echo “value is $value <br/>”;
}

//second method is create array
$number [0]=”one”;
$number [0]=”Two”;
$number [0]=”Three”;
$number[0]=”Four”;
$number [0]=”Five”;
foreach($number as $value)
{
echo “value is $value<br/>”;
 }
?>
</body>
</html>

Video Tutorial Here
                                                
Adbox