Numeric Array in PHP

Numeric arrays can store numbers, strings and any object but their index will be represented by numbers. By default array index starts from zero. In other words, we can say arrays with a numeric index. Take a look at following example:


$numbers = array( 1, 2, 3, 4, 5);
foreach( $numbers as $value )
  echo "Value is $value <br />";

$names = array("alpha","beta","Gamma");

foreach( $names as $value )
  echo "Name is $value <br />";

Run it on the localhost and you will get the result:


Latest Content