Skip to content

PHP code snippet – How get the latest arraye value in laravel?

$languages = [
  'JAVA',
  'PHP',
  'C++',
  'C#',
  'Python',
];
$totalElements = count($languages);
echo $languages[$totalElements - 1];
See also  Python code snippet - How to only print final iteration of a for loop pyhton?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.