3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ ['food' => 'banana', 'count' => 43], ['food' => 'cheese strings', 'count' => 5], ['food' => 'bananas', 'count' => 3], ['food' => 'tea towle', 'count' => 2], ]; $firstRow = reset($data); $lastRow = end($data); var_dump($firstRow, $lastRow);
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
array(2) { ["food"]=> string(6) "banana" ["count"]=> int(43) } array(2) { ["food"]=> string(9) "tea towle" ["count"]=> int(2) }

preferences:
73.29 ms | 407 KiB | 5 Q