Alright so basically what I want to do, is everytime someone gets muted(ive done that) I want the reason to be stored in a YAML under his name which is fine for the first one, although the second time he gets muted I want it to be stored as as second value, not overiding the second one Ex: Code: Steve: - Advertising - Hacking And then I want to be able to get these values as a string but every value has a new line Ex: Code: $reasons = ''; foreach ($this->mute->getNested("$name.Mute") as $reason) { $reasons .= '\n-' . $reason; } How would I do that? Ive tried many things but can't get to make it work
You don't have to manually encode or decode YAML yourself. "Steve" is an array containing the elements listed below it. You just yaml_emit(["Steve" => ["Advertising", "Hacking"]]) to get that result you showed in your yml file, and yaml_parse($file_contents) to get the array back.