- json_decode: documentation ( source)
- print_r: documentation ( source)
<?php
$json = '{"language":"en","education":[{"unit":"e1","language":"en"}],"membership":[{"uei":"21","Uifed":"failed"}]}';
$arrayData = json_decode($json, true);
foreach ($arrayData['membership'] as &$membership) {
if ('failed' === $membership['Uifed']) {
$membership['Uifed'] = 'success';
}
}
print_r($arrayData);