File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -418,6 +418,22 @@ you can dump them as ``~`` with the ``DUMP_NULL_AS_TILDE`` flag::
418
418
$dumped = Yaml::dump(['foo' => null], 2, 4, Yaml::DUMP_NULL_AS_TILDE);
419
419
// foo: ~
420
420
421
+ Dumping Numeric Keys as Strings
422
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
423
+
424
+ By default, digit-only array keys are dumped as integers. You can use the
425
+ ``DUMP_NUMERIC_KEY_AS_STRING `` flag if you want to dump string-only keys::
426
+
427
+ $dumped = Yaml::dump([200 => 'foo']);
428
+ // 200: foo
429
+
430
+ $dumped = Yaml::dump([200 => 'foo'], 2, 4, Yaml::DUMP_NUMERIC_KEY_AS_STRING);
431
+ // '200': foo
432
+
433
+ .. versionadded :: 6.3
434
+
435
+ The ``DUMP_NUMERIC_KEY_AS_STRING `` flag was introduced in Symfony 6.3.
436
+
421
437
Syntax Validation
422
438
~~~~~~~~~~~~~~~~~
423
439
You can’t perform that action at this time.
0 commit comments