Issues (13)

examples/compact_notation.php (2 issues)

Labels
Severity
1
<?php
2
require_once __DIR__.'/../vendor/autoload.php';
3
4
use Dallgoot\Yaml\Yaml;
5
6
$yamlContent = <<<EOF
7
compact_object: {a: 1, b: 2, c: OK}
8
9
compact_array: [0,1,2,OK]
10
EOF;
11
12
$obj = Yaml::parse($yamlContent);
13
14
//printing specifically some values
15
print_r($obj->compact_object->c);
0 ignored issues
show
The property compact_object does not seem to exist on Dallgoot\Yaml\Types\YamlObject.
Loading history...
16
print_r($obj->compact_array[3]);
0 ignored issues
show
The property compact_array does not seem to exist on Dallgoot\Yaml\Types\YamlObject.
Loading history...
17
18
//modifying those same values
19
$obj->compact_object->c = 3;
20
$obj->compact_array[3] = 3;
21
22
//printing the corresponding YAML
23
print_r(Yaml::dump($obj));