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
Bug
introduced
by
![]() |
|||
16 | print_r($obj->compact_array[3]); |
||
0 ignored issues
–
show
|
|||
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)); |