Skip to content

Kirby 3.8.4

$pages->nth()

Returns the nth element from the collection

$pages->nth(int $n): mixed

Parameters

Name Type Default
$n * int

Return type

mixed

Parent class

Kirby\Cms\Pages inherited from Kirby\Toolkit\Collection

Example

// echo the title of the 4th subpage
// (the index starts at 0)
echo $page->children()->nth(3)->title();