PageRenderTime 4ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/vendor/spyc/lib/examples/yaml-dump.php

http://zoop.googlecode.com/
PHP | 25 lines | 13 code | 4 blank | 8 comment | 1 complexity | 0a1951b4f2a21b9982a2d2933a8c7267 MD5 | raw file
 1<?php
 2
 3#
 4#    S P Y C
 5#      a simple php yaml class
 6#
 7# Feel free to dump an array to YAML, and then to load that YAML back into an
 8# array.  This is a good way to test the limitations of the parser and maybe
 9# learn some basic YAML.
10#
11
12include('../spyc.php');
13
14$array[] = 'Sequence item';
15$array['The Key'] = 'Mapped value';
16$array[] = array('A sequence','of a sequence');
17$array[] = array('first' => 'A sequence','second' => 'of mapped values');
18$array['Mapped'] = array('A sequence','which is mapped');
19$array['A Note'] = 'What if your text is too long?';
20$array['Another Note'] = 'If that is the case, the dumper will probably fold your text by using a block.  Kinda like this.';
21$array['The trick?'] = 'The trick is that we overrode the default indent, 2, to 4 and the default wordwrap, 40, to 60.';
22$array['Old Dog'] = "And if you want\n to preserve line breaks, \ngo ahead!";
23$array['key:withcolon'] = "Should support this to";
24
25$yaml = Spyc::YAMLDump($array,4,60);