Mega Code Archive

 
Categories / Php / Data Type
 

Use the index in square brackets to create new elements and or assign values

<? $myarray = array('one', 2, 'three'); $myarray[1] = 'two'; $myarray[3] = 'four'; echo($myarray[0]); echo($myarray[1]); echo($myarray[2]); echo($myarray[3]); ?>