prepare('SELECT * FROM home WHERE iduser = ? ORDER BY idhome DESC'); $stmt->execute([$user['id']]); $rows = $stmt->fetchAll(); $counts = home_counts($pdo, array_column($rows, 'idhome')); $homes = array_map(fn ($h) => present_home($h, true, $counts[(int) $h['idhome']] ?? null), $rows); json_data($homes);