public function lindex($collection, $key, $index) { $list = $this->getKey($collection, $key, []); if ($index < 0) { $index = count($list) - abs($index); } return isset($list[$index]) ? $list[$index] : null; }