Answer the question
In order to leave comments, you need to log in
Yaml/php how to parse correctly?
<?
var_dump(yaml_parse('foo: [b]'));
var_dump(yaml_parse('foo: [n]'));
var_dump(yaml_parse('foo: [y]'));
array(1) {
["foo"]=>
array(1) {
[0]=>
string(1) "b"
}
}
array(1) {
["foo"]=>
array(1) {
[0]=>
bool(false)
}
}
array(1) {
["foo"]=>
array(1) {
[0]=>
bool(true)
}
}
Module Version 1.2.0
LibYAML Version 0.1.6
Answer the question
In order to leave comments, you need to log in
If you do not change the incoming yaml - then nothing. Y/N are key characters and are interpreted as booleans according to the specification . If you need to get a symbolic representation, enclose them in quotes:
var_dump(yaml_parse("foo: ['y']"));
array(1) {
["foo"]=>
array(1) {
[0]=>
string(1) "y"
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question