freescout-calendar-module/vendor/dallgoot/yaml/examples/read.php
2024-09-10 16:29:40 +02:00

26 lines
No EOL
510 B
PHP

<?php
require_once __DIR__.'/../vendor/autoload.php';
use Dallgoot\Yaml\Yaml;
$debug = 0;
/* USE CASE 1
* load and parse if file exists
*/
$yaml = Yaml::parseFile('./examples/dummy.yml', 0, $debug);
print_r($yaml->object->array[0]);
$yamlContent = <<<EOF
--- some document we don't care about
# below the document we want
---
- ignore_me
- mapping:
somekey:
array:
- OK
EOF;
$second_document = Yaml::parse($yamlContent)[1];
print_r($second_document[1]->mapping->somekey->array[0]);