| Site Map | WizTools.org | jCraze Blog |
![]() |
Subhash's Guide: PHP ArraysTo remind you of the basics, in PHP you need not initialize (declare) a variable. Array is a collection of data items (variables) with a common name but with different subscript (index) value. In the following ways, array elements can be assigned values: Type IEg.
$bros[0]='Subhash'; Another element can be inserted into this array:
$bros[]='Sudhir'; This is same as:
$bros[2]='Sudhir'; The PHP interpretor automatically appends the unindexed array assignment next to the last element of the array. Type IIYou can also use the array() method for assigning values to array elements: $bros=array('Subhash','Sarat','Sudhir'); A Special Type of ArrayTraditional languages like C take only integer or integer variable as array subscript. But PHP also takes string as subscript:
$hollywood['handsomehunk']='Arnold'; Using array() method: $hollywood=array('handsomehunk'=>'Arnold','sexbomb'=>'SharonStone'); Multidimensional ArrayYes, PHP also supports multidimensional array:
$hollywood['handsomehunk']['favorite1']='Arnold'; |
Sign Guestbook
|
Who is Subhash?
The contents of this site are copyright© 2000-2008, indiWiz.com. All Rights Reserved.