Skip to content

Instantly share code, notes, and snippets.

@telless
Created February 24, 2018 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save telless/5a314f589a86c7e7795e43c60a5d84fd to your computer and use it in GitHub Desktop.
Save telless/5a314f589a86c7e7795e43c60a5d84fd to your computer and use it in GitHub Desktop.
<?php
$a = [1, 1, 1, 2, 3, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6];
$count = [];
foreach ($a as $v) {
if (isset($count[$v])) {
unset($count[$v]);
} else {
$count[$v] = true;
}
}
echo join(' ', array_keys($count));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment