CBOREncode
CBOREncode copied to clipboard
After null elimination, data disappears, is it a bug or a feature?
$target = array(
true,
array(
"variable1" => 100000,
"variable2" => "Hello, World!",
"Hello!"
),
0.234,
0,
null,
590834290589032580
);
$encoded_data = \CBOR\CBOREncoder::encode($target);
$decoded_variable = \CBOR\CBOREncoder::decode($encoded_data);
var_dump($decoded_variable);
Response:
array(4) {
[0]=> bool(true)
[1]=> array(3) {
["variable1"]=> int(100000)
["variable2"]=> string(13) "Hello, World!"
[0]=> string(6) "Hello!"
}
[2]=> float(0.234)
[3]=> int(0)
}