Use the index in square brackets to create new elements and or assign values : Array Element « Data Structure « PHP
- PHP
- Data Structure
- Array Element
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]);
?>
Related examples in the same category