Monday, April 1, 2013

Arrays in php


An array stores multiple values in one single variable:

<?php
$cars=array("Volvo","BMW","Toyota");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>



Array in PHP

In PHP, the array() function is used to create an array:
array();
In PHP, there are three types of arrays:
  • Indexed arrays - Arrays with numeric index
  • Associative arrays - Arrays with named keys
  • Multidimensional arrays - Arrays containing one or more arrays

No comments:

Post a Comment