1 | <?php |
||
2 | require_once __DIR__.'/../vendor/autoload.php'; |
||
3 | |||
4 | use Dallgoot\Yaml\Yaml; |
||
5 | |||
6 | $debug = 0; |
||
7 | |||
8 | /* USE CASE 1 |
||
9 | * load and parse if file exists |
||
10 | */ |
||
11 | $yaml = Yaml::parseFile('./examples/dummy.yml', 0, $debug); |
||
12 | |||
13 | print_r($yaml->object->array[0]); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
14 | |||
15 | $yamlContent = <<<EOF |
||
16 | --- some document we don't care about |
||
17 | # below the document we want |
||
18 | --- |
||
19 | - ignore_me |
||
20 | - mapping: |
||
21 | somekey: |
||
22 | array: |
||
23 | - OK |
||
24 | EOF; |
||
25 | $second_document = Yaml::parse($yamlContent)[1]; |
||
26 | print_r($second_document[1]->mapping->somekey->array[0]); |