Skip to content

Commit 35f85e4

Browse files
committed
Added note on YAML mappings as objects
1 parent 330d40d commit 35f85e4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: components/yaml/introduction.rst

+10
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ error if something goes wrong by adding the filename to the message.
148148

149149
.. _components-yaml-dump:
150150

151+
Objects for Mappings
152+
....................
153+
154+
Yaml :ref:`mappings <yaml-format-collections>` are basically associative arrays. You can instruct the parser to return
155+
mappings as objects (i.e. ``\stdClass`` instances)::
156+
157+
$object = Yaml::parse('{"hello": "world"}', false, false, true);
158+
echo get_class($object); // stdClass
159+
echo $object->hello; // world
160+
151161
Writing YAML Files
152162
~~~~~~~~~~~~~~~~~~
153163

Diff for: components/yaml/yaml_format.rst

+2
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ YAML uses the ISO-8601 standard to express dates:
165165
# simple date
166166
2002-12-14
167167
168+
.. _yaml-format-collections:
169+
168170
Collections
169171
-----------
170172

0 commit comments

Comments
 (0)