- var_dump: documentation ( source)
- json_decode: documentation ( source)
- base64_decode: documentation ( source)
- base64_encode: documentation ( source)
- json_encode: documentation ( source)
<?php
$x = <<<X
eyJleHBlcmltZW50SWQiOiJtanQwX3VSaVNQdXJOLXNBMThsclFRIiwiY2hvc2VuVmFyaWF0aW9uIjoiMSIsInVzZXJJc0luY2x1ZGVkIjoiMSJ9
X;
$x = json_decode(base64_decode($x), true);
$x['chosenVariation'] = 0;
$encoded = base64_encode(json_encode($x));
var_dump($encoded);
var_dump(json_decode(base64_decode($x), true));