Saturday, March 20, 2010

PHP - Arrays

------------------------------------------------------------
To stores multiple values in one variable
------------------------------------------------------------

There are 3 kinds of array in PHP:
  • Numeric - An array with a numeric index.
  • Associative - An array which ID key is associated with a value.
  • Multidimensional - An array containing one/more arrays.

Numeric Arrays

There are 2 methods to create a numeric array:

or


For instances:


###################################################
The Output: Yamaha and Honda are Japanese motorcycles.
###################################################


Associative Arrays

For instances:


##########################################
The Output: The weight of Ahmad is 70 kilograms.
##########################################


Multidimensional Arrays

For instances:


#############################################
The Output: Is Farouk a part of the Malay family?
#############################################

0 comments:

Post a Comment