fork download
  1. <?php
  2.  
  3. $arr = ['2015', '2015', '2012', '2013', '2014', '2014', '2016'];
  4.  
  5. $res = array_keys(array_filter(array_count_values($arr), function($v){
  6. return $v == 1;
  7. }));
  8.  
  9. print_r($res);
Success #stdin #stdout 0.02s 24212KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 2012
    [1] => 2013
    [2] => 2016
)