How to Get First and Last Element of array in PHP?

Hello friends, today I will tell you through this tutorial how you can get the value of first and last of any array through php.

How to Get First and Last Element from array Using PHP, Finding First and Last Element entires in array Using PHP, Get First and Last Element in array in PHP

For example, you have values ​​from 1 to 10 in the format of the array and you want to get the first value of the array and the second value of the array. So how do you remove this value through php? The example of this is given to you below.

    $array = array(22.0,22.1,22.2,22.3,22.4,22.5,22.6);
    $myfirst_element = reset($array);
    $mylast_element = end($array);
    var_dump($myfirst_element, $mylast_element);