Get form data as a list of key-value pairs
List keys are not preserved by default. Use $flags
to modify this
behaviour.
If no $dateFormatter
is given, a {@see DateFormatter} is created to
convert {@see DateTimeInterface} instances to ISO-8601 strings.
$callback
is applied to objects other than {@see DateTimeInterface}
instances found in $data
. It may return null
to skip the value, or
false
to process the value as if no callback had been given. If a
{@see DateTimeInterface} is returned, it is converted to string
as per
the $dateFormatter
note above.
If no $callback
is given, objects are resolved as follows:
- {@see DateTimeInterface}: converted to
string
(see $dateFormatter
note above)
- {@see Arrayable}: replaced with {@see Arrayable::toArray()}
- {@see JsonSerializable}: replaced with
{@see JsonSerializable::jsonSerialize()} if it returns an
array
- {@see Jsonable}: replaced with {@see Jsonable::toJson()} after decoding
if {@see json_decode()} returns an
array
-
object
with at least one public property: replaced with an array that
maps public property names to values
- {@see Stringable}: cast to
string