Add chain_to_string function

This function turns the chain into a string that can be sent to the group
This commit is contained in:
Ceda EI 2018-04-03 20:15:12 +05:30
parent fedd816e73
commit 90f69802cb
1 changed files with 13 additions and 0 deletions

View File

@ -70,5 +70,18 @@ function get_longest_chain() {
} }
return $chains[$longest_chain_index]; return $chains[$longest_chain_index];
} }
# Converts chain to string for sending
function chain_to_string($chain) {
$string = "";
for ($i = count($chain) - 1; $i >= 0 ; $i--) {
$string .= $chain[$i]['username'];
if ($i != 0) {
$string .= " > ";
}
}
return $string;
}
$conn->close(); $conn->close();
?> ?>