$transaction) { $member = getMemberWithoutSystem($transaction["author"]) ?? getMemberWithoutSystem("zdtsg"); $trans = [ "id" => $index, "author" => [ "avatar" => getAsset($member["_system"], $member["id"]), "name" => $member["display_name"] ?? $member["name"] ], "type" => $transaction["amount"] < 0 ? "REMOVE" : "ADD", "amount" => round(abs($transaction["amount"]), 2), "date" => [ "ts" => strtotime($transaction["date"]), "iso" => date('c', strtotime($transaction["date"])), "relative" => timeAgo($transaction["date"]) ], "description" => (isset($transaction["description"]) && trim($transaction["description"]) !== "") ? trim($transaction["description"]) : null ]; $acc["transactions"][] = $trans; } $obj = $acc; } } /* ------------------- */ die(json_encode($obj, JSON_PRETTY_PRINT));