|
Last change
on this file since 69 was
23,
checked in by anonymous, 6 years ago
|
|
init
|
-
Property svn:executable set to
*
|
|
File size:
973 bytes
|
| Line | |
|---|
| 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 | |
|---|
| 12 | include('../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); |
|---|
Note: See
TracBrowser
for help on using the repository browser.