Eno\Fieldset » elements

elements() → array

Retrieve the entries of this fieldset as Field elements (instead of their direct values) in sequential order. This seamlessly lets you switch from associative readout to sequential readout, allowing fieldsets to also represent document-like structures instead of just associative data.

enopreferences:
alice = icetea
bob = peppermint tea
jane = no tea at all
ann = earl grey
php$document = Parser::parse($input);
$preferences = $document->fieldset('preferences');

$html = '<h1>Observe these fascinating tea preferences, presented in html!</h1>';

foreach($preferences->elements() as $element) {
  $html .= "<strong>{$element->name}</strong> likes {$element->value()}.<br>";
}

file_put_contents('index.html', $html);

Return value

An array containing the elements of this section.