▼  Site Navigation Main Articles News Search  ▼  Anime + Manga Anime Reviews Anime Characters Gallery Screenshots Manga Reviews  ▼  Misc Links to Webcomics Bible Quotes About Older Musings
site version 7.3
PHP –– array manipulation
written by: admin


Date Written: 5/25/10 Last Updated: 5/25/10

Both of these will retrieve the second to last value of an array.

<?php
$arr=array("q","w","e","r","t");
echo $arr[count($arr)-2];
?>


<?php
$inversed = array_reverse($array);
$end = $inversed[1];
?>



See also

PHP –– sorting arrays

TAGS: php
copyright 2005–2024