How to Get Last Element of Array in Laravel

Hello Artisan,

In this tutorial, I will show you, how to get last element of array in php laravel. So in this how to get last index of array in php laravel tutorial, you will see a php code of getting last element of array.

So if you don't know how to get last element of array in php Laravel, then this tutorial is for you. See the below example code:


$duratiion = [1,2,3,4,5,6];
echo $duratiion [count($duratiion )-1];

// Output — 6


Read also: Creating File Manager in Laravel Step By Step Guide


Hope it can help you.


Facebook Github
A web enthusiastic, a self-motivated full-stack software engineer from Dhaka, Bangladesh with experience in developing applications using Laravel , React and Vue js