File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -440,6 +440,38 @@ By default, digit-only array keys are dumped as integers. You can use the
440440 $dumped = Yaml::dump([200 => 'foo'], 2, 4, Yaml::DUMP_NUMERIC_KEY_AS_STRING);
441441 // '200': foo
442442
443+ Dumping Collection of Maps
444+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
445+
446+ By default, the collection of maps uses a hyphen on a separate line as a delimiter.
447+ To use the delimiter line as part of the map dump, use the ``Yaml::DUMP_COMPACT_NESTED_MAPPING `` flag.
448+
449+ Dump without flag set:
450+
451+ .. code-block :: text
452+
453+ planets:
454+ -
455+ name: Mercury
456+ distance: 57910000
457+ -
458+ name: Jupiter
459+ distance: 778500000
460+
461+ Dump with ``Yaml::DUMP_COMPACT_NESTED_MAPPING `` flag set:
462+
463+ .. code-block :: php
464+
465+ $dumped = Yaml::dump(['planets' => $planets], 2, 0, Yaml::DUMP_COMPACT_NESTED_MAPPING);
466+
467+ .. code-block :: text
468+
469+ planets:
470+ - name: Mercury
471+ distance: 57910000
472+ - name: Jupiter
473+ distance: 778500000
474+
443475 Syntax Validation
444476~~~~~~~~~~~~~~~~~
445477
You can’t perform that action at this time.
0 commit comments