Mega Code Archive

 
Categories / Php / Data Type
 

Creating Arrays

<?php   $my_array = array();   $pets = array('A', 'S', 'B', 'W');   $person = array('B', 'J', 24, 'CA');   $customer = array('first' => 'Bill', 'last' => 'Jones','age' => 24, 'state' => 'CA');   print "<p>Pet number 1 is named '$pets[0]'.</p>\n";   print "<p>The person's age is $person[2].</p>\n";   print "<p>The customer's age is {$customer['age']}.</p>\n"; ?>