Friday, April 5, 2013

PHP Array -> Associative Arrays

Associative rray: It is variable whose datatype is array and keys are string, number, combination of string and number of that array. Following are 3 example of Associative Array.
 $countries1 = array(
  'IN'=>'IN',
  'PAK'=>'PAK',
  'AUS'=>'AUS',
  'US'=>'US'
);
$countries2 = array(
  '1'=>'IN',
  '2'=>'PAK',
  '3'=>'AUS',
  '4'=>'US'
  );
  
  $countries2 = array(
  'C2'=>'IN',
  'C3'=>'PAK',
  'C4'=>'AUS',
  'C5'=>'US'
  );

No comments:

Post a Comment