Adding an Element to the End of an Array
<?php
$languages = array();
$languages[] = 'German';
$languages[] = 'French';
$languages[] = 'Spanish';
printf("<p>Languages: %s.</p>\n", implode(', ', $languages));
?>
<?php
$languages = array();
array_push($languages, 'German', 'French', 'Spanish');
printf("<p>Languages: %s.</p>\n", implode(', ', $languages));
?>
Related examples in the same category