Added Canvas 1.1.0, originally not under SCM so no historical development records...
[canvas.git] / library / YAML / yaml-dump.php
blob8a343de7c7acc57f1c53e8c30d73344dd21daaf9
1 <?php
4 # S P Y C
5 # a simple php yaml class
6 # v0.2(.2)
8 # author: [chris wanstrath, chris@ozmm.org]
9 # websites: [http://www.yaml.org, http://spyc.sourceforge.net/]
10 # license: [MIT License, http://www.opensource.org/licenses/mit-license.php]
11 # copyright: (c) 2005-2006 Chris Wanstrath
13 # Feel free to dump an array to YAML, and then to load that YAML back into an
14 # array. This is a good way to test the limitations of the parser and maybe
15 # learn some basic YAML.
18 include('spyc.php');
20 $array[] = 'Sequence item';
21 $array['The Key'] = 'Mapped value';
22 $array[] = array('A sequence','of a sequence');
23 $array[] = array('first' => 'A sequence','second' => 'of mapped values');
24 $array['Mapped'] = array('A sequence','which is mapped');
25 $array['A Note'] = 'What if your text is too long?';
26 $array['Another Note'] = 'If that is the case, the dumper will probably fold your text by using a block. Kinda like this.';
27 $array['The trick?'] = 'The trick is that we overrode the default indent, 2, to 4 and the default wordwrap, 40, to 60.';
28 $array['Old Dog'] = "And if you want\n to preserve line breaks, \ngo ahead!";
30 $yaml = Spyc::YAMLDump($array,4,60);
32 echo '<pre>A PHP array run through YAMLDump():<br/>';
33 print_r($yaml);
34 echo '</pre>';