function Form::getPhpValues
Gets the field values as PHP.
This method converts fields with the array notation (like foo[bar] to arrays) like PHP does.
File
-
vendor/
symfony/ dom-crawler/ Form.php, line 121
Class
- Form
- Form represents an HTML form.
Namespace
Symfony\Component\DomCrawlerCode
public function getPhpValues() : array {
$values = [];
foreach ($this->getValues() as $name => $value) {
$qs = http_build_query([
$name => $value,
], '', '&');
if ($qs) {
parse_str($qs, $expandedValue);
$varName = substr($name, 0, \strlen(key($expandedValue)));
$values[] = [
$varName => current($expandedValue),
];
}
}
return array_replace_recursive([], ...$values);
}