Closed D91 closed 7 years ago
Test code. Using Spyc 0.5.1
#!/usr/bin/env php <?php require_once("lib/Spyc.php"); function test_roundtrip($data){ $yaml = Spyc::YAMLDump($data); $parsed = Spyc::YAMLLoad($yaml); if($parsed !== $data){ echo "STARTED WITH: " . json_encode($data), "\n"; echo "ENDED UP WITH: ".json_encode($parsed), "\n"; echo "YAML:\n$yaml\n"; echo "\n------------------\n"; } } test_roundtrip(array('a' => "b\n"));
Output:
STARTED WITH: {"a":"b\n"} ENDED UP WITH: {"a":"|\n b"} YAML: --- a: | | b
Test code. Using Spyc 0.5.1
Output: