From 35f85e4b9199d460bd3f689df45f943863e54fd8 Mon Sep 17 00:00:00 2001 From: dantleech Date: Sat, 21 May 2016 13:37:16 +0100 Subject: [PATCH] Added note on YAML mappings as objects --- components/yaml/introduction.rst | 10 ++++++++++ components/yaml/yaml_format.rst | 2 ++ 2 files changed, 12 insertions(+) diff --git a/components/yaml/introduction.rst b/components/yaml/introduction.rst index c61b40fa0e4..529290461e8 100644 --- a/components/yaml/introduction.rst +++ b/components/yaml/introduction.rst @@ -148,6 +148,16 @@ error if something goes wrong by adding the filename to the message. .. _components-yaml-dump: +Objects for Mappings +.................... + +Yaml :ref:`mappings ` are basically associative arrays. You can instruct the parser to return +mappings as objects (i.e. ``\stdClass`` instances):: + + $object = Yaml::parse('{"hello": "world"}', false, false, true); + echo get_class($object); // stdClass + echo $object->hello; // world + Writing YAML Files ~~~~~~~~~~~~~~~~~~ diff --git a/components/yaml/yaml_format.rst b/components/yaml/yaml_format.rst index 0a776be2a70..2e9d24a95ef 100644 --- a/components/yaml/yaml_format.rst +++ b/components/yaml/yaml_format.rst @@ -165,6 +165,8 @@ YAML uses the ISO-8601 standard to express dates: # simple date 2002-12-14 +.. _yaml-format-collections: + Collections -----------