Skip to content

Instantly share code, notes, and snippets.

@eteeselink eteeselink/oneOnOneId.php
Last active Oct 24, 2018

Embed
What would you like to do?
PHP implementation of TalkJS's `Talk.oneOnOneId` function
<?php
function oneOnOneId(string $meId, string $otherId) {
$ids = [$meId, $otherId];
sort($ids, SORT_STRING);
return substr(sha1(json_encode($ids)), 0, 20);
}
echo oneOnOneId("aa", "bb"); // fd031b78f1add01539dc
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.